jsat.classifiers.linear
Class LinearL1SCD
- java.lang.Object
-
- jsat.classifiers.linear.StochasticSTLinearL1
-
- jsat.classifiers.linear.LinearL1SCD
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized, Regressor, SimpleWeightVectorModel, SingleWeightVectorModel
public class LinearL1SCD extends StochasticSTLinearL1
Implements an iterative and single threaded form of fast Stochastic Coordinate Decent for optimizing L1 regularized linear regression problems. It performs very well when the number of data points is very large, especially when the feature count is smaller in comparison. It also works well on sparse data sets.
Using the squared loss is equivalent to LASSO regression, and the LOG loss is equivalent to logistic regression.
Note: This implementation requires all feature values to be in the range [-1, 1]. By default scaling is performed to [0,1]. If your data is dense or has negative and positive feature values, scaling to [-1, 1] may perform better. SeeStochasticSTLinearL1.setReScale(boolean)
See:
Shalev-Shwartz, S.,&Tewari, A. (2009). Stochastic Methods for L1-regularized Loss Minimization. 26th International Conference on Machine Learning (Vol. 12, pp. 929–936).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class jsat.classifiers.linear.StochasticSTLinearL1
StochasticSTLinearL1.Loss
-
-
Field Summary
-
Fields inherited from class jsat.classifiers.linear.StochasticSTLinearL1
DEFAULT_EPOCHS, DEFAULT_LOSS, DEFAULT_REG
-
-
Constructor Summary
Constructors Constructor and Description LinearL1SCD()Creates a new SCD L1 learner using default settings.LinearL1SCD(int epochs, double lambda, StochasticSTLinearL1.Loss loss)Creates a new SCD L1 learner.LinearL1SCD(int epochs, double lambda, StochasticSTLinearL1.Loss loss, boolean reScale)Creates a new SCD L1 learner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.LinearL1SCDclone()doubleregress(DataPoint data)booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidtrain(ClassificationDataSet dataSet)Trains the classifier and constructs a model for classification using the given data set.voidtrain(ClassificationDataSet dataSet, boolean parallel)Trains the classifier and constructs a model for classification using the given data set.voidtrain(RegressionDataSet dataSet)voidtrain(RegressionDataSet dataSet, boolean parallel)-
Methods inherited from class jsat.classifiers.linear.StochasticSTLinearL1
getBias, getBias, getEpochs, getLambda, getLoss, getMaxScaled, getMinScaled, getRawWeight, getRawWeight, getW, getWRaw, isReScale, numWeightsVecs, setEpochs, setLambda, setLoss, setMaxScaled, setMinScaled, setReScale
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Constructor Detail
-
LinearL1SCD
public LinearL1SCD()
Creates a new SCD L1 learner using default settings.
-
LinearL1SCD
public LinearL1SCD(int epochs, double lambda, StochasticSTLinearL1.Loss loss)Creates a new SCD L1 learner.- Parameters:
epochs- the number of learning iterationslambda- the regularization penaltyloss- the loss function to use
-
LinearL1SCD
public LinearL1SCD(int epochs, double lambda, StochasticSTLinearL1.Loss loss, boolean reScale)Creates a new SCD L1 learner.- Parameters:
epochs- the number of learning iterationslambda- the regularization penaltyloss- the loss function to usereScale- whether or not to rescale the feature values
-
-
Method Detail
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Parameters:
data- the data point to classify- Returns:
- the results of the classification.
-
regress
public double regress(DataPoint data)
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
train
public void train(RegressionDataSet dataSet)
-
train
public void train(ClassificationDataSet dataSet, boolean parallel)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set. If the training method knows how, it will used the threadPool to conduct training in parallel. This method will block until the training has completed.- Parameters:
dataSet- the data set to train onparallel-trueif multiple threads should be used to train the model.falseif it should be done in a single threaded manner.
-
train
public void train(ClassificationDataSet dataSet)
Description copied from interface:ClassifierTrains the classifier and constructs a model for classification using the given data set.- Parameters:
dataSet- the data set to train on
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.- Returns:
- true if the model supports weighted data, false otherwise
-
clone
public LinearL1SCD clone()
- Specified by:
clonein interfaceClassifier- Specified by:
clonein interfaceRegressor- Specified by:
clonein classStochasticSTLinearL1
-
-
DataMelt 3.0 © DataMelt by jWork.ORG