fr.lip6.classifier
Class EnhancedSMOSVM<T>

java.lang.Object
  extended by fr.lip6.classifier.EnhancedSMOSVM<T>
Type Parameters:
T - Type de donnée de l'espace d'entrée.
All Implemented Interfaces:
Classifier<T>, java.io.Serializable

public class EnhancedSMOSVM<T>
extends java.lang.Object
implements Classifier<T>, java.io.Serializable

Classifieur SVM utilisant l'algorithme SMO de J. Platt avec l'implementation de weka.
N'importe quel type peut être traité, pourvu qu'un noyau Kernel Soit fournit.

Author:
dpicard
See Also:
Serialized Form

Field Summary
protected  double m_bLow
          The thresholds.
protected  double m_bUp
          The thresholds.
protected  double[] m_class
          The transformed class values.
protected  java.util.ArrayList<T> m_data
          The training data.
protected static double m_Del
          Precision constant for updating sets
protected  double[] m_errors
          The current set of errors for all non-bound examples.
protected  java.util.TreeSet<java.lang.Integer> m_I0
          {i: 0 < m_alpha[i] < C}
protected  java.util.TreeSet<java.lang.Integer> m_I1
          {i: m_class[i] = 1, m_alpha[i] = 0}
protected  java.util.TreeSet<java.lang.Integer> m_I2
          {i: m_class[i] = -1, m_alpha[i] =C}
protected  java.util.TreeSet<java.lang.Integer> m_I3
          {i: m_class[i] = 1, m_alpha[i] = C}
protected  java.util.TreeSet<java.lang.Integer> m_I4
          {i: m_class[i] = -1, m_alpha[i] = 0}
protected  int m_iLow
          The indices for m_bLow and m_bUp
protected  int m_iUp
          The indices for m_bLow and m_bUp
protected  int[] m_sparseIndices
           
protected  double[] m_sparseWeights
          Variables to hold weight vector in sparse form.
protected  double m_sumOfWeights
          Stores the weight of the training instances
protected  java.util.TreeSet<java.lang.Integer> m_supportVectors
          The set of support vectors
protected  double[] m_weights
          Weight vector for linear machine.
 
Constructor Summary
EnhancedSMOSVM(Kernel<T> k)
          Constructeur passant le noyau servant à calculer la similarité entre les éléments de l'espace d'entrée.
 
Method Summary
protected  boolean examineExample(int i2)
          Examines instance.
 double[] getAlphas()
           
protected  boolean takeStep(int i1, int i2, double F2)
          Method solving for the Lagrange multipliers for two instances.
 void train(java.util.ArrayList<TrainingSample<T>> t)
          Replace the current training 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_bLow

protected double m_bLow
The thresholds.


m_bUp

protected double m_bUp
The thresholds.


m_iLow

protected int m_iLow
The indices for m_bLow and m_bUp


m_iUp

protected int m_iUp
The indices for m_bLow and m_bUp


m_data

protected java.util.ArrayList<T> m_data
The training data.


m_weights

protected double[] m_weights
Weight vector for linear machine.


m_sparseWeights

protected double[] m_sparseWeights
Variables to hold weight vector in sparse form. (To reduce storage requirements.)


m_sparseIndices

protected int[] m_sparseIndices

m_class

protected double[] m_class
The transformed class values.


m_errors

protected double[] m_errors
The current set of errors for all non-bound examples.


m_I0

protected java.util.TreeSet<java.lang.Integer> m_I0
{i: 0 < m_alpha[i] < C}


m_I1

protected java.util.TreeSet<java.lang.Integer> m_I1
{i: m_class[i] = 1, m_alpha[i] = 0}


m_I2

protected java.util.TreeSet<java.lang.Integer> m_I2
{i: m_class[i] = -1, m_alpha[i] =C}


m_I3

protected java.util.TreeSet<java.lang.Integer> m_I3
{i: m_class[i] = 1, m_alpha[i] = C}


m_I4

protected java.util.TreeSet<java.lang.Integer> m_I4
{i: m_class[i] = -1, m_alpha[i] = 0}


m_supportVectors

protected java.util.TreeSet<java.lang.Integer> m_supportVectors
The set of support vectors


m_sumOfWeights

protected double m_sumOfWeights
Stores the weight of the training instances


m_Del

protected static double m_Del
Precision constant for updating sets

Constructor Detail

EnhancedSMOSVM

public EnhancedSMOSVM(Kernel<T> k)
Constructeur passant le noyau servant à calculer la similarité entre les éléments de l'espace d'entrée.

Parameters:
k - le noyau templatisé en
Method Detail

train

public void train(TrainingSample<T> t)
Description copied from interface: Classifier
Add a single example to the current training set and train the classifier

Specified by:
train in interface Classifier<T>
Parameters:
t - the training sample

train

public void train(java.util.ArrayList<TrainingSample<T>> t)
Description copied from interface: Classifier
Replace the current training and train the classifier

Specified by:
train in interface Classifier<T>
Parameters:
t - list of training samples

examineExample

protected boolean examineExample(int i2)
Examines instance.

Parameters:
i2 - index of instance to examine
Returns:
true if examination was successfull
Throws:
java.lang.Exception - if something goes wrong

takeStep

protected boolean takeStep(int i1,
                           int i2,
                           double F2)
Method solving for the Lagrange multipliers for two instances.

Parameters:
i1 - index of the first instance
i2 - index of the second instance
F2 -
Returns:
true if multipliers could be found
Throws:
java.lang.Exception - if something goes wrong

valueOf

public double valueOf(T e)
Description copied from interface: Classifier
Computes the category of the provided example

Specified by:
valueOf in interface Classifier<T>
Parameters:
e - example
Returns:
>0. if e belongs to the category, <0. if not.

getAlphas

public double[] getAlphas()