Giter Site home page Giter Site logo

xy's Introduction

R build status codecov

Simulating Supervised Learning Data drawing

With Xy() you can convienently simulate supervised learning data. The simulation can be very specific, since there are many degrees of freedom for the user. For instance, the functional shape of the nonlinearity is user-defined as well. Interactions can be formed and (co)variances altered.

There are numerous applications for the package, e.g.:

  • Learning a new machine learning algorithm in a controlled environment
  • Benchmarking feature selection algorithms in a controlled environment
  • Create sample data to test productionized ML applications in a CI / CD pipeline.

Usage

The usage is pretty straight forward. I strongly encourage you to read the help document to explore all functionalities.

Install

The Xy() package uses the GNU scientific library. Linux and MacOs users are adviced to install this package before installing the code from github.

Mac:

Install through Homebrew via

brew install gsl

Linux:

sudo apt-get install libgsl-dev

All Operating systems:

Install the package with remotes:

# install.packages("remotes") 
# install from github
remotes::install_github("andrebleier/Xy")            

Simulate data

You can simulate regression and classification data with interactions and a user-specified non-linearity. The usage is in a tidy way. First you create a simulation recipe, which is a combination of the overall task invoked by Xy() . Afterwards effects can be added to the recipe with the add_* functions as can be seen in the example below. Finally the simulate() function cooks this recipe.

# load the library
library(Xy)
# simulate regression data
task <- Xy(task = "regression")

# build the recipe
recipe <- task %>%
  # adding linear features
  add_linear(p = 5, family = xy_normal()) %>%
  # adding non-linear cubic features
  add_nonlinear(p = 3, nlfun= function(x) x^3, family = xy_normal()) %>%
  # add uninformative effects
  add_uninformative(p = 3, collinearity = TRUE, family = xy_normal()) %>%
  # add dummy variables
  add_discrete(p = 3, levels = 3) %>%
  # add normally distributed noise, which correlates with the features
  add_noise(collinearity = TRUE, family = xy_normal()) %>%
  # add an intercept
  add_intercept()
  
# cook the recipe
sim <- recipe %>%
  simulate(n = 100, r_squared = 0.8)

# fetch the data
sim %>% pull_xy()

Feature Importance

You can extract a feature importance of your simulation. For instance, to benchmark feature selection algorithms.

# Feature Importance 
variable_importance <- sim %>% importance()

drawing

Feel free to contact me with input and ideas.

xy's People

Contributors

andremonaco avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.