Description Usage Arguments Details Value Author(s) References See Also Examples
While enet() produces the entire path of solutions, predict.enet allows one to extract a prediction at a particular point along the path.
1 2 3 |
object |
A fitted enet object |
newx |
If type="fit", then newx should be the x values at which the fit is required. If type="coefficients", then newx can be omitted. |
s |
a value, or vector of values, indexing the path. Its values depends on the mode= argument. By default (mode="step"). |
type |
If type="fit", predict returns the fitted values. If type="coefficients", predict returns the coefficients. Abbreviations allowed. |
mode |
Mode="step" means the s= argument indexes the LARS-EN step number, and the coefficients will be returned corresponding to the values corresponding to step s. If mode="fraction", then s should be a number between 0 and 1, and it refers to the ratio of the L1 norm of the coefficient vector, relative to the norm at the full LS solution. Mode="norm" means s refers to the L1 norm of the coefficient vector. Abbreviations allowed. If mode="norm", then s should be the L1 norm of the coefficient vector. If mode="penalty", then s should be the 1-norm penalty parameter. |
naive |
IF naive is True, then the naive elastic net fit is returned. |
... |
Additonal arguments for generic print. |
Starting from zero, the LARS-EN algorithm provides the entire sequence of coefficients and fits.
Either a vector/matrix of fitted values, or a vector/matrix of coefficients.
Hui Zou and Trevor Hastie
Zou and Hastie (2005) "Regularization and Variable Selection via the Elastic Net" Journal of the Royal Statistical Society, Series B,67,301-320.
print, plot, enet
1 2 3 4 5 6 7 8 9 10 11 | data(diabetes)
attach(diabetes)
object <- enet(x,y,lambda=0.1)
### make predictions at the values in x, at each of the
### steps produced in object
fits <- predict.enet(object, x, type="fit")
### extract the coefficient vector with L1 norm=2000
coef2000 <- predict(object, s=2000, type="coef", mode="norm")
### extract the coefficient vector with L1 norm fraction=0.45
coef.45 <- predict(object, s=0.45, type="coef", mode="fraction")
detach(diabetes)
|
Loading required package: lars
Loaded lars 1.2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.