public class DoubleSGDQN extends java.lang.Object implements Classifier<double[]>
Linear SVM classifier using SGDQN algorithm.
Careful Quasi-Newton Stochastic Gradient Descent
Antoine Bordes, Léon Bottou, and Patrick Gallinari
J. Mach. Learn. Res. 10 (December 2009), 1737-1754.
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
|
static boolean |
VERBOSE
Sets the verbosity of training procedure (if true, details are printed during learning)
|
Constructor and Description |
---|
DoubleSGDQN() |
Modifier and Type | Method and Description |
---|---|
DoubleSGDQN |
copy()
Creates and returns a copy of this object.
|
double |
getC()
Tells the C hyperparameter
|
int |
getEpochs()
Tells the number of epochs used for training this classifier
|
double |
getLambda()
Tells the learning rate lambda
|
int |
getLoss()
Tells the type of loss used by this classifier
|
double[] |
getW()
Tells the array of coordinates of the hyperplane used by this classifier
|
boolean |
isNormalize()
Tells if training datas are centered/reduced as preprocessing before learning
|
void |
setC(double c)
Set the C hyperparameter (automatically converted to learning rate lambda)
|
void |
setEpochs(int epochs)
Sets the number of epochs used for training this classifier
|
void |
setLambda(double lambda)
Sets the learning rate lambda
|
void |
setLoss(int loss)
Sets the type of loos used by this classifier
|
void |
setNormalize(boolean normalize)
Sets if training datas are centered/reduced as preprocessing before learning
|
void |
setW(double[] w)
Sets the array of coordinate used by this classifier
|
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
|
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 static boolean VERBOSE
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 double valueOf(double[] e)
Classifier
valueOf
in interface Classifier<double[]>
e
- examplepublic int getLoss()
public void setLoss(int loss)
loss
- an integer value representing the loss (default: HINGELOSS)public double[] getW()
public void setW(double[] w)
w
- the array of coordinatespublic double getLambda()
public void setLambda(double lambda)
lambda
- the learning ratepublic int getEpochs()
public void setEpochs(int epochs)
epochs
- the number of epochspublic boolean isNormalize()
public void setNormalize(boolean normalize)
normalize
- true for center/reduce (default false)public double getC()
public void setC(double c)
c
- the hyperparameter Cpublic DoubleSGDQN copy() throws java.lang.CloneNotSupportedException
copy
in interface Classifier<double[]>
java.lang.CloneNotSupportedException
Object.clone()