public class DoubleSAG extends java.lang.Object implements Classifier<double[]>, java.io.Serializable
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 |
---|
DoubleSAG() |
Modifier and Type | Method and Description |
---|---|
Classifier<double[]> |
copy()
Creates and returns a copy of this object.
|
double |
getB()
Get the bias of the classifier
|
long |
getE()
Get the number of epochs (one pass through the entire data-set)
|
double |
getLambda()
Get the regularization parameter lambda
|
int |
getLoss()
Tells the loss function the classifier is currently using
|
double[] |
getW()
Get the normal to the separating hyperplane
|
boolean |
isCyclic()
Is the algorithm doing epoch of ordered samples
|
void |
setB(double b)
Set the bias of the classifier
|
void |
setCyclic(boolean cyclic)
Set the order of the sample at each epoch
|
void |
setE(long e)
Set the number of epochs (one pass through the entire data-set)
|
void |
setLambda(double lambda)
Set the regularization parameter lambda
|
void |
setLoss(int loss)
Sets the loss function to use for next training
|
void |
setW(double[] w)
Set the normal to the hyperplane
|
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 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 Classifier<double[]> copy() throws java.lang.CloneNotSupportedException
Classifier
copy
in interface Classifier<double[]>
java.lang.CloneNotSupportedException
Object.clone()
public int getLoss()
public void setLoss(int loss)
loss
- an integer specifying the loss to use (HINGELOSS,
SQUAREDHINGELOSS, etc)public double[] getW()
public void setW(double[] w)
w
- the normal vectorpublic double getB()
public void setB(double b)
b
- the biaspublic double getLambda()
public void setLambda(double lambda)
lambda
- the regularization parameterpublic long getE()
public void setE(long e)
e
- the number of epochpublic boolean isCyclic()
public void setCyclic(boolean cyclic)
cyclic
- true is the order remains the same through all epochs, false
is the order is randomized at each epoch