Class ElasticNet

java.lang.Object
smile.regression.ElasticNet

public class ElasticNet extends Object
Elastic Net regularized linear regression.

Elastic Net linearly combines the L1 (LASSO) and L2 (Ridge) penalties, overcoming limitations of LASSO when features are highly correlated or when the number of features exceeds the sample size (p > n).

The optimization problem can be reformulated as an equivalent LASSO problem on augmented response and covariate matrices. Because the strictly convex L2 penalty guarantees a unique global minimum, the objective remains strictly convex even when the feature matrix is not full rank.

References

  • H. Zou and T. Hastie. Regularization and variable selection via the elastic net. Journal of the Royal Statistical Society: Series B, 67(2):301-320, 2005.
  • K. P. Murphy. Machine Learning: A Probabilistic Perspective, Section 13.5.3. MIT Press, 2012.
  • Method Details

    • fit

      public static LinearModel fit(Formula formula, DataFrame data, double lambda1, double lambda2)
      Fits an Elastic Net regularized linear model.
      Parameters:
      formula - formula specifying response and predictors.
      data - training data frame.
      lambda1 - L1 penalty coefficient.
      lambda2 - L2 penalty coefficient.
      Returns:
      fitted LinearModel.
    • fit

      public static LinearModel fit(Formula formula, DataFrame data, ElasticNet.Options options)
      Fits an Elastic Net regularized linear model with full options.
      Parameters:
      formula - formula specifying response and predictors.
      data - training data frame.
      options - algorithm hyperparameters.
      Returns:
      fitted LinearModel.