Class ElasticNet

java.lang.Object
smile.regression.ElasticNet

public class ElasticNet extends Object
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

  1. Kevin P. Murphy: Machine Learning A Probabilistic Perspective, Section 13.5.3, 2012
  2. Zou, Hui, Hastie, Trevor: Regularization and Variable Selection via the Elastic Net, 2005
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    fit(smile.data.formula.Formula formula, smile.data.DataFrame data, double lambda1, double lambda2)
    Fits an Elastic Net model.
    fit(smile.data.formula.Formula formula, smile.data.DataFrame data, double lambda1, double lambda2, double tol, int maxIter)
    Fits an Elastic Net model.
    fit(smile.data.formula.Formula formula, smile.data.DataFrame data, Properties params)
    Fits an Elastic Net model.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ElasticNet

      public ElasticNet()
  • Method Details

    • fit

      public static LinearModel fit(smile.data.formula.Formula formula, smile.data.DataFrame data, Properties params)
      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

      public static LinearModel fit(smile.data.formula.Formula formula, smile.data.DataFrame data, double lambda1, double lambda2)
      Fits an Elastic Net model. The hyper-parameters in prop include
      • lambda1 is the L1 shrinkage/regularization parameter
      • lambda2 is the L2 shrinkage/regularization parameter
      • tolerance 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 parameter
      lambda2 - the L2 shrinkage/regularization parameter
      Returns:
      the model.
    • fit

      public static LinearModel fit(smile.data.formula.Formula formula, smile.data.DataFrame data, double lambda1, double lambda2, double tol, int maxIter)
      Fits an Elastic Net model. The hyper-parameters in prop include
      • lambda1 is the L1 shrinkage/regularization parameter
      • lambda2 is the L2 shrinkage/regularization parameter
      • tolerance 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 parameter
      lambda2 - the L2 shrinkage/regularization parameter
      tol - the tolerance for stopping iterations (relative target duality gap).
      maxIter - the maximum number of IPM (Newton) iterations.
      Returns:
      the model.