jsat.classifiers.linear
Class LinearTools
- java.lang.Object
-
- jsat.classifiers.linear.LinearTools
-
public class LinearTools extends java.lang.ObjectThis class provides static helper methods that may be useful for various linear models.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static doublec2Lambda(double C, double N)Many linear classifiers can be phrased in two equivalent forms, that only change the notation for the regularized.static doublelambda2C(double lambda, double N)Many linear classifiers can be phrased in two equivalent forms, that only change the notation for the regularized.static doublemaxLambdaLogisticL1(ClassificationDataSet cds)If the linear model performs logistic regression regularized by λ ||w||1, this method computes the smallest value of lambda that produces a weight vector of all zeros.
Note, that the value returned depends on the data set size.
-
-
-
Method Detail
-
maxLambdaLogisticL1
public static double maxLambdaLogisticL1(ClassificationDataSet cds)
If the linear model performs logistic regression regularized by λ ||w||1, this method computes the smallest value of lambda that produces a weight vector of all zeros.
Note, that the value returned depends on the data set size. If being used to initialize the value of λ for cross validation with k-folds, the value (k-1)/k * λ will be closer to the correct value of λ for each CV set.- Parameters:
cds- the data set that the model would be trained from- Returns:
- the smallest value of λ that should produce all zeros.
-
lambda2C
public static double lambda2C(double lambda, double N)Many linear classifiers can be phrased in two equivalent forms, that only change the notation for the regularized. These forms are:
C ∑i ℓ(w,xi) + Ω(w)
and
1/N ∑i ℓ(w,xi) + λ Ω(w)
This method converts the regularization parameter λ to the form used as C- Parameters:
lambda- the regularization parameter λN- the number of data points in the training set- Returns:
-
c2Lambda
public static double c2Lambda(double C, double N)Many linear classifiers can be phrased in two equivalent forms, that only change the notation for the regularized. These forms are:
C ∑i ℓ(w,xi) + Ω(w)
and
1/N ∑i ℓ(w,xi) + λ Ω(w)
This method converts the regularization parameter C to the form used as λ- Parameters:
C- the regularization parameter CN- the number of data points in the training set- Returns:
-
-
DataMelt 3.0 © DataMelt by jWork.ORG