public class DoubleSGD extends java.lang.Object implements Classifier<double[]>
Linear SVM classifier using stochastic gradient descent algorithm
Large-Scale Machine Learning with Stochastic Gradient Descent
Léon Bottou
Proceedings of the 19th International Conference on Computational Statistics (COMPSTAT'2010)
Modifier and Type | Field and Description |
---|---|
static int |
HINGELOSS
Type of loss function using hinge
|
static int |
LOGLOSS
Type of loss function using log
|
static int |
LOGLOSSMARGIN
Type of loss function using margin log
|
static int |
SMOOTHHINGELOSS
Type of loss function using a smoothed hinge
|
static int |
SQUAREDHINGELOSS
Type of loss function using a squared hinge
|
Constructor and Description |
---|
DoubleSGD() |
Modifier and Type | Method and Description |
---|---|
DoubleSGD |
copy()
Creates and returns a copy of this object.
|
int |
getEpochs()
Tells the number of epochs this classifier uses for learning
|
double |
getLambda()
Returns the hyper-parameter lambda
|
int |
getLoss()
Tells the type of loss used by this classifier (default HINGELOSS)
|
double[] |
getW()
Tells the arrays of coordinate of separating hyperplane
|
boolean |
isHasBias()
Tells if this classifier is using a bias term
|
boolean |
isShuffle()
Tells if samples are shuffled while learning
|
void |
setEpochs(int epochs)
Sets the number of epochs this classifier uses for learning
|
void |
setHasBias(boolean hasBias)
Sets the use of a bias term
|
void |
setLambda(double l)
Sets the learning rate lambda
|
void |
setLoss(int loss)
Sets the type of loss used by this classifier (default HINGELOSS)
|
void |
setShuffle(boolean shuffle)
Sets if samples should be shuffled while learning
|
void |
train(java.util.List<TrainingSample<double[]>> l)
Replace the current training list and train the classifier
|
void |
train(TrainingSample<double[]> t)
Add a single example to the current training set and train the classifier
|
void |
trainOnce(java.util.List<TrainingSample<double[]>> l)
Update the separating hyperplane by learning one epoch on given training list
|
double |
valueOf(double[] e)
Computes the category of the provided example
|
public static final int HINGELOSS
public static final int SMOOTHHINGELOSS
public static final int SQUAREDHINGELOSS
public static final int LOGLOSS
public static final int LOGLOSSMARGIN
public void train(TrainingSample<double[]> t)
Classifier
train
in interface Classifier<double[]>
t
- the training samplepublic void train(java.util.List<TrainingSample<double[]>> l)
Classifier
train
in interface Classifier<double[]>
l
- list of training samplespublic void trainOnce(java.util.List<TrainingSample<double[]>> l)
l
- the training listpublic double valueOf(double[] e)
Classifier
valueOf
in interface Classifier<double[]>
e
- examplepublic double[] getW()
public int getLoss()
public void setLoss(int loss)
loss
- public void setLambda(double l)
l
- the learning ratepublic boolean isHasBias()
public void setHasBias(boolean hasBias)
hasBias
- true if use of bias termpublic int getEpochs()
public void setEpochs(int epochs)
epochs
- the number of epochspublic boolean isShuffle()
public void setShuffle(boolean shuffle)
shuffle
- true if shufflepublic DoubleSGD copy() throws java.lang.CloneNotSupportedException
copy
in interface Classifier<double[]>
java.lang.CloneNotSupportedException
Object.clone()
public double getLambda()