Package smile.regression
Class ElasticNet
java.lang.Object
smile.regression.ElasticNet
Elastic Net regularization. The elastic net is a regularized regression
method that linearly combines the L1 and L2 penalties of the lasso and ridge
methods.
The elastic net problem can be reduced to a lasso problem on modified data and response. And note that the penalty function of Elastic Net is strictly convex so there is a unique global minimum, even if input data matrix is not full rank.
References
- Kevin P. Murphy: Machine Learning A Probabilistic Perspective, Section 13.5.3, 2012
- Zou, Hui, Hastie, Trevor: Regularization and Variable Selection via the Elastic Net, 2005
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic LinearModel
Fits an Elastic Net model.static LinearModel
Fits an Elastic Net model.static LinearModel
fit
(Formula formula, DataFrame data, Properties params) Fits an Elastic Net model.
-
Constructor Details
-
ElasticNet
public ElasticNet()
-
-
Method Details
-
fit
Fits an Elastic Net model.- Parameters:
formula
- a symbolic description of the model to be fitted.data
- the data frame of the explanatory and response variables. NO NEED to include a constant column of 1s for bias.params
- the hyper-parameters.- Returns:
- the model.
-
fit
Fits an Elastic Net model. The hyper-parameters inprop
includelambda1
is the L1 shrinkage/regularization parameterlambda2
is the L2 shrinkage/regularization parametertolerance
is the tolerance for stopping iterations (relative target duality gap).iterations
is the maximum number of IPM (Newton) iterations.
- Parameters:
formula
- a symbolic description of the model to be fitted.data
- the data frame of the explanatory and response variables. NO NEED to include a constant column of 1s for bias.lambda1
- the L1 shrinkage/regularization parameterlambda2
- the L2 shrinkage/regularization parameter- Returns:
- the model.
-
fit
public static LinearModel fit(Formula formula, DataFrame data, double lambda1, double lambda2, double tol, int maxIter) Fits an Elastic Net model. The hyper-parameters inprop
includelambda1
is the L1 shrinkage/regularization parameterlambda2
is the L2 shrinkage/regularization parametertolerance
is the tolerance for stopping iterations (relative target duality gap).iterations
is the maximum number of IPM (Newton) iterations.
- Parameters:
formula
- a symbolic description of the model to be fitted.data
- the data frame of the explanatory and response variables. NO NEED to include a constant column of 1s for bias.lambda1
- the L1 shrinkage/regularization parameterlambda2
- the L2 shrinkage/regularization parametertol
- the tolerance for stopping iterations (relative target duality gap).maxIter
- the maximum number of IPM (Newton) iterations.- Returns:
- the model.
-