T
- Datatype of training samplespublic class SMOSVM<T> extends java.lang.Object implements KernelSVM<T>, java.io.Serializable, java.lang.Cloneable
SVM classifier using SMO algorithm
Sequential Minimal Optimization: A Fast Algorithm for Training Support Vector Machines
John Platt
no. MSR-TR-98-14, April 1998
Constructor and Description |
---|
SMOSVM(Kernel<T> k)
Constructor using the specified kernel as similarity measure between samples
|
Modifier and Type | Method and Description |
---|---|
SMOSVM<T> |
copy()
Creates and returns a copy of this object.
|
double[] |
getAlphas()
Tells the weights of training samples
|
double |
getB()
Tells the bias b of (w*x - b)
|
double |
getC()
Tells the hyperparameter C
|
Kernel<T> |
getKernel()
Tells the current Kernel.
|
java.util.ArrayList<TrainingSample<T>> |
getTrainingSet()
Tells the ArrayList of TrainingSample used for training
|
void |
retrain()
Train again the classifier (default restart from scratch)
|
void |
setAlphas(double[] a)
Sets the samples weights
|
void |
setC(double c)
Sets the hyperparameter C
|
void |
setKernel(Kernel<T> k)
Sets the kernel to use as similarity measure
|
void |
setTrain(java.util.ArrayList<TrainingSample<T>> t)
Sets the list of training samples
|
void |
train(java.util.List<TrainingSample<T>> t)
Replace the current training list and train the classifier
|
void |
train(TrainingSample<T> t)
Add a single example to the current training set and train the classifier
|
double |
valueOf(T e)
Computes the category of the provided example
|
public void train(TrainingSample<T> t)
Classifier
train
in interface Classifier<T>
t
- the training samplepublic void train(java.util.List<TrainingSample<T>> t)
Classifier
train
in interface Classifier<T>
t
- list of training samplespublic void retrain()
public double valueOf(T e)
Classifier
valueOf
in interface Classifier<T>
e
- examplepublic double[] getAlphas()
KernelSVM
public double getB()
public double getC()
KernelSVM
public void setC(double c)
KernelSVM
public java.util.ArrayList<TrainingSample<T>> getTrainingSet()
public void setKernel(Kernel<T> k)
KernelSVM
public void setAlphas(double[] a)
a
- an array of double representing the weights in the order of the training listpublic void setTrain(java.util.ArrayList<TrainingSample<T>> t)
t
- the list of training samplespublic SMOSVM<T> copy() throws java.lang.CloneNotSupportedException
copy
in interface Classifier<T>
java.lang.CloneNotSupportedException
Object.clone()