kitchen_sweep: Quickly check performance of different CKS models

View source: R/kitchen_sweep.R

kitchen_sweepR Documentation

Quickly check performance of different CKS models

Description

Sweeps across a set of feature counts and window sizes to provide an idea of how different Convolutional Kitchen Sinks perform. Trains on a set of training data, x and y, and validates on separate data. Only uses a single normal matrix for each model, so expect some variance.

Usage

kitchen_sweep(
  trainx,
  trainy,
  valx,
  valy,
  featuresweep,
  windowsweep,
  clampoutliers = TRUE,
  verbose = FALSE,
  show.plot = FALSE,
  seed = NULL,
  ...
)

Arguments

trainx

A matrix of independent data the models will be trained on.

trainy

A vector of dependent data the models will be trained on. trainy[i] should correspond to trainx[i,].

valx

A matrix of independent data the kitchen sink models will use to make predictions. Columns should be organized identically to the trainx data.

valy

A vector of dependent data the kitchen sink models will use to validate predictions. valy[i] should correspond to valx[i,]

featuresweep

A vector of feature counts to sweep across.

windowsweep

A vector of window sizes to sweep across.

clampoutliers

Clamp predicted values beyond range of training values to the minimum or maximum of the training values.

verbose

Print progress.

show.plot

Draw plots of predicted values versus true for each model.

seed

A seed to generate identical normal matrices.

...

Arguments to be passed to kitchen_sink().

Details

Models are trained by ridge regression using cv.glmnet, allowing for reduction of overfitting.

Value

Returns a matrix of the adjusted R^2 values from the linear models lm(valy ~ predictions(valx)) for each model. Index [f,w] returns R^2 of the model for featuresweep[f] and windowsweep[w].

Author(s)

Avery Kruger

See Also

make_norms()

kitchen_prediction

kitchen_sink()

Examples

x <- matrix(sample(1:10,1000,TRUE),200,5)
y <- x[,1]*x[,2]^2-0.5*x[,3]*x[,4]+x[,5]*x[,1]*x[,3]-x[,3]^2*x[,2]

kitchen_sweep(trainx = x[1:100,],
trainy = y[1:100],
valx = x[101:200,],
valy = y[101:200],
featuresweep = c(2^(4:7),2^11,4000,6000,7000,2^13),
windowsweep = 2:5,
verbose = TRUE,
ncores=2)


avery-kruger/kitchen documentation built on May 7, 2024, 6:40 a.m.