| refit | R Documentation |
Refits a SLOPE model using the optimal parameters found through cross-validation. This is a convenience function to avoid having to manually extract optimal parameters and refit.
refit(object, x, y, measure = NULL, ...)
object |
an object of class |
x |
the design matrix |
y |
the response vector |
measure |
which performance measure to use for selecting optimal
parameters. If |
... |
additional arguments passed to |
An object of class 'SLOPE' fit with the optimal parameters
SLOPE()
Other model-tuning:
cvSLOPE(),
plot.TrainedSLOPE(),
summary.TrainedSLOPE(),
trainSLOPE()
# Cross-validation
tune <- trainSLOPE(
bodyfat$x,
bodyfat$y,
q = c(0.1, 0.2),
measure = "mse"
)
# Refit with optimal parameters
fit <- refit(tune, bodyfat$x, bodyfat$y)
# Use the fitted model
coef(fit)
predict(fit, bodyfat$x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.