| trainSLOPE | R Documentation |
This function trains a model fit by SLOPE() by tuning its parameters
through cross-validation.
trainSLOPE(
x,
y,
q = 0.2,
number = 10,
repeats = 1,
measure = c("mse", "mae", "deviance", "misclass", "auc"),
...,
weights = NULL
)
x |
the design matrix, which can be either a dense matrix of the standard matrix class, or a sparse matrix inheriting from Matrix::sparseMatrix. Data frames will be converted to matrices internally. |
y |
the response, which for |
q |
parameter controlling the shape of the lambda sequence, with usage
varying depending on the type of path used and has no effect is a custom
|
number |
number of folds (cross-validation) |
repeats |
number of repeats for each fold (for repeated k-fold cross validation) |
measure |
measure to try to optimize; note that you may supply multiple values here and that, by default, all the possible measures for the given model will be used. |
... |
other arguments to pass on to |
weights |
observation weights as in |
Note that by default this method matches all of the available metrics for the
given model family against those provided in the argument measure.
Collecting these measures is not particularly demanding computationally so it
is almost always best to leave this argument as it is and then choose which
argument to focus on in the call to plot.TrainedSLOPE().
The initial fit on the full data supplies the absolute alphas used in
every fold.
An object of class "TrainedSLOPE", with the following slots:
summary |
a summary of the results with means, standard errors, and 0.95 confidence levels |
data |
the raw data from the model training |
optima |
a |
measure |
a |
model |
the model fit to the entire data set |
training_data |
the training data used for tuning ( |
family |
the model family used for tuning |
call |
the call |
Other model-tuning:
cvSLOPE(),
plot.TrainedSLOPE(),
refit(),
summary.TrainedSLOPE()
# 8-fold cross-validation repeated 5 times
tune <- trainSLOPE(
subset(mtcars, select = c("mpg", "drat", "wt")),
mtcars$hp,
q = c(0.1, 0.2),
number = 8,
repeats = 5,
measure = "mse"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.