jsat.classifiers.linear
Class SMIDAS
- java.lang.Object
-
- jsat.classifiers.linear.StochasticSTLinearL1
-
- jsat.classifiers.linear.SMIDAS
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, Parameterized, Regressor, SimpleWeightVectorModel, SingleWeightVectorModel
public class SMIDAS extends StochasticSTLinearL1
Implements the iterative and single threaded stochastic solver for L1 regularized linear regression problems SMIDAS (Stochastic Mirror Descent Algorithm mAde Sparse). It performs very well when the number of features is large relative to or greater than the number of data points. It also works decently on smaller 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] to preserve sparseness. 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 SMIDAS(double eta)Creates a new SMIDAS learnerSMIDAS(double eta, int epochs, double lambda, StochasticSTLinearL1.Loss loss)Creates a new SMIDAS learnerSMIDAS(double eta, int epochs, double lambda, StochasticSTLinearL1.Loss loss, boolean reScale)Creates a new SMIDAS 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.SMIDASclone()doublegetEta()Returns the current learning rate used during trainingdoubleregress(DataPoint data)voidsetEta(double eta)Sets the learning rate used during trainingbooleansupportsWeightedData()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
-
SMIDAS
public SMIDAS(double eta)
Creates a new SMIDAS learner- Parameters:
eta- the learning rate for each iteration
-
SMIDAS
public SMIDAS(double eta, int epochs, double lambda, StochasticSTLinearL1.Loss loss)Creates a new SMIDAS learner- Parameters:
eta- the learning rate for each iterationepochs- the number of learning iterationslambda- the regularization penaltyloss- the loss function to use
-
SMIDAS
public SMIDAS(double eta, int epochs, double lambda, StochasticSTLinearL1.Loss loss, boolean reScale)Creates a new SMIDAS learner- Parameters:
eta- the learning rate for each iterationepochs- the number of learning iterationslambda- the regularization penaltyloss- the loss function to usereScale- whether or not to rescale the feature values
-
-
Method Detail
-
setEta
public void setEta(double eta)
Sets the learning rate used during training- Parameters:
eta- the learning rate to use
-
getEta
public double getEta()
Returns the current learning rate used during training- Returns:
- the learning rate in use
-
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(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
-
train
public void train(RegressionDataSet dataSet, boolean parallel)
-
train
public void train(RegressionDataSet dataSet)
-
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 SMIDAS clone()
- Specified by:
clonein interfaceClassifier- Specified by:
clonein interfaceRegressor- Specified by:
clonein classStochasticSTLinearL1
-
-
DataMelt 3.0 © DataMelt by jWork.ORG