public class ElasticNet extends java.lang.Object implements Regression<double[]>
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.
Constructor and Description |
---|
ElasticNet(double[][] x,
double[] y,
double lambda1,
double lambda2)
Constructor.
|
ElasticNet(double[][] x,
double[] y,
double lambda1,
double lambda2,
double tol,
int maxIter)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
double[] |
coefficients() |
double |
intercept()
Returns the intercept.
|
LASSO |
lasso() |
double |
predict(double[] x)
Predicts the dependent variable of an instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
predict
public ElasticNet(double[][] x, double[] y, double lambda1, double lambda2)
x
- a matrix containing the explanatory variables. NO NEED to include
a constant column of 1s for bias.y
- the response values.lambda1
- the shrinkage/regularization parameter for L1lambda2
- the shrinkage/regularization parameter for L2public ElasticNet(double[][] x, double[] y, double lambda1, double lambda2, double tol, int maxIter)
x
- a matrix containing the explanatory variables. NO NEED to include
a constant column of 1s for bias.y
- the response values.lambda1
- the shrinkage/regularization parameter for L1lambda2
- the shrinkage/regularization parameter for L2tol
- the tolerance for stopping iterations (relative target duality
gap).maxIter
- the maximum number of IPM (Newton) iterations.public double predict(double[] x)
Regression
predict
in interface Regression<double[]>
x
- the instance.public double[] coefficients()
public double intercept()