View source: R/kitchen_prediction.R
kitchen_prediction | R Documentation |
'kitchen_prediction' trains models on CKS-projected training data and then predicts values for some other data using those models.
kitchen_prediction(
trainx,
trainy,
predictx,
features,
windows,
verbose = TRUE,
simplify = FALSE,
clampoutliers = TRUE,
bootstrap = NULL,
seed = NULL,
write_progress = NULL,
...
)
trainx |
A matrix of independent data to use for training models. trainx[i,] should correspond with trainy[i]. |
trainy |
A vector of dependent data to use for training models. trainy[i] should correspond with trainx[i,]. |
predictx |
A vector or matrix to predict values for. Values must correspond with the training data. |
features |
A value or vector of feature counts to use in the kitchen sink models. |
windows |
A value or vector of window sizes to use in the kitchen sink models. Values should not exceed the column length of the data. |
verbose |
Print progress. |
simplify |
Return a matrix rather than a list when there is only one combination of feature count and window size. |
clampoutliers |
Clamp predicted values beyond range of training values to the minimum or maximum of the training values. |
bootstrap |
A number of times to bootstrap predictions by predicting from data sampled with replacement. |
seed |
Set a seed for repeatable norms. |
write_progress |
A file name to write predictions to. |
... |
Arguments to be passed to |
This function has a few uses. Most simply, it can generate predictions for
data from a single kitchen sink model when provided with a single set of
hyperparameters (feature count and window size). kitchen_sweep
()
can quickly assess what hyperparameters perform best. Models are trained by
ridge regression using cv.glmnet
, allowing for reduction
of overfitting. When 'reps' is greater than one, this function makes multiple
predictions using unique normal matrices; the set of predictions can be used
for confidence intervals of the true kernel function. If a set of
hyperparameters are provided, the function will generate predictions
for each unique combination, which could allow for model averaging.
Returns a list where index [[f]][[w]] returns the predicted values from a model with feature count features[f] and window size windows[w].
Avery Kruger
kitchen_sweep
()
x <- matrix(sample(1:10,10000,TRUE),2000,5)
y <- 5*x[,1] + 20*x[,1]*x[,2] + 3*x[,3]^2 - 10*x[,4] - 2*x[,5]
kitchen_sweep(x[1:1000,],y[1:1000],
x[1001:2000,],y[1001:2000],
2^(4:8),2:5)
a <- matrix(sample(1:10,1000,TRUE),1,5)
b <- 5*a[,1] + 20*a[,1]*a[,2] + 3*a[,3]^2 - 10*a[,4] - 2*a[,5]
mybootstrap <- kitchen_prediction(x,y,a,64,5,bootstrap=10)
hist(unlist(mybootstrap))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.