T - Datatype of training samplespublic class SimpleMKL<T> extends java.lang.Object implements Classifier<T>, KernelSVM<T>, MKL<T>, java.io.Serializable
Implementation of the SimpleMKL solver.
Java conversion of the original matlab code.
SimpleMKL
Alain Rakotomamonjy, Francis Bach, Stephane Canu, Yves Grandvalet
Journal of Machine Learning Research 9 (2008) 2491-2521
| Modifier and Type | Field and Description |
|---|---|
protected double |
C |
protected boolean |
checkDualGap |
protected boolean |
checkKKT |
protected double |
eps |
protected double |
epsDG |
protected double |
epsGS |
protected double |
epsKTT |
protected java.util.ArrayList<Kernel<T>> |
kernels |
protected java.util.ArrayList<java.lang.Double> |
kernelWeights |
protected java.util.List<TrainingSample<T>> |
list |
protected int |
maxIteration |
protected double |
numPrec |
protected KernelSVM<T> |
svm |
| Constructor and Description |
|---|
SimpleMKL() |
| Modifier and Type | Method and Description |
|---|---|
void |
addKernel(Kernel<T> k)
adds a kernel to the MKL problem
|
protected java.lang.Object |
clone() |
SimpleMKL<T> |
copy()
Creates and returns a copy of this object.
|
double[] |
getAlphas()
Tells the weights of training samples
|
double |
getC()
Tells the values of hyperparameter C
|
KernelSVM<T> |
getClassifier()
Returns the classifier used by this MKL algorithm
|
double |
getDualGap()
Tells the value of stopping criteria
|
Kernel<T> |
getKernel()
Tells the current Kernel.
|
java.util.List<Kernel<T>> |
getKernels()
Gets an array of the kernels in the set, in the same order as
getKernelWeights()
|
java.util.Map<Kernel<T>,java.lang.Double> |
getKernelWeightMap()
Gets a mapping of pairs
|
double[] |
getKernelWeights()
Gets an array containing the weights of the different kernels, in the
same order as getKernels()
|
int |
getMaxIteration()
Returns the maximum number of outer loop iterations
|
double[] |
getTrainingWeights()
Deprecated.
|
java.util.Map<Kernel<T>,java.lang.Double> |
getWeights()
Deprecated.
|
void |
removeKernel(Kernel<T> k)
Removes a kernel from the MKL problem
|
void |
retrain() |
void |
setC(double c)
Sets the value of the hyperparameter C
|
void |
setClassifier(KernelSVM<T> cls)
Sets the default training algorithm for the underlying svm calls (default LASVM).
|
void |
setDualGap(double epsDG)
Sets the value of the stopping criteria
|
void |
setKernel(Kernel<T> k)
Sets the kernel to use as similarity measure
|
void |
setMaxIteration(int maxIteration)
Sets the maximum number of outer loop iterations
|
void |
train(java.util.List<TrainingSample<T>> l)
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
|
protected java.util.List<TrainingSample<T>> list
protected java.util.ArrayList<java.lang.Double> kernelWeights
protected int maxIteration
protected double C
protected double numPrec
protected double epsKTT
protected double epsDG
protected double epsGS
protected double eps
protected boolean checkDualGap
protected boolean checkKKT
public void removeKernel(Kernel<T> k)
k - the kernel to removepublic void train(TrainingSample<T> t)
Classifiertrain in interface Classifier<T>t - the training samplepublic void train(java.util.List<TrainingSample<T>> l)
Classifiertrain in interface Classifier<T>l - list of training samplespublic void retrain()
public double valueOf(T e)
ClassifiervalueOf in interface Classifier<T>e - examplepublic double[] getTrainingWeights()
public void setKernel(Kernel<T> k)
KernelSVMpublic double[] getAlphas()
KernelSVMprotected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic double[] getKernelWeights()
MKLgetKernelWeights in interface MKL<T>public java.util.Map<Kernel<T>,java.lang.Double> getWeights()
public java.util.Map<Kernel<T>,java.lang.Double> getKernelWeightMap()
MKLgetKernelWeightMap in interface MKL<T>public java.util.List<Kernel<T>> getKernels()
MKLgetKernels in interface MKL<T>public double getC()
public void setC(double c)
public double getDualGap()
public void setDualGap(double epsDG)
epsDG - the dual gappublic void setClassifier(KernelSVM<T> cls)
cls - the algorithm used to solve the svm problempublic SimpleMKL<T> copy() throws java.lang.CloneNotSupportedException
copy in interface Classifier<T>java.lang.CloneNotSupportedExceptionObject.clone()public KernelSVM<T> getClassifier()
public int getMaxIteration()
public void setMaxIteration(int maxIteration)
maxIteration - number of iterations