public class SMO.BinarySMO
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
m_alpha
The Lagrange multipliers.
|
protected double |
m_b
The thresholds.
|
protected double |
m_bLow
The thresholds.
|
protected double |
m_bUp
The thresholds.
|
protected Instances |
m_calibrationDataHeader
Reference to the header information for the calibration data
|
protected Classifier |
m_calibrator
Stores calibrator model for probability estimate
|
protected double[] |
m_class
The transformed class values.
|
protected Instances |
m_data
The training data.
|
protected double[] |
m_errors
The current set of errors for all non-bound examples.
|
protected SMOset |
m_I0
{i: 0 < m_alpha[i] < C}
|
protected SMOset |
m_I1
{i: m_class[i] = 1, m_alpha[i] = 0}
|
protected SMOset |
m_I2
{i: m_class[i] = -1, m_alpha[i] =C}
|
protected SMOset |
m_I3
{i: m_class[i] = 1, m_alpha[i] = C}
|
protected SMOset |
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 Kernel |
m_kernel
Kernel to use
|
protected int |
m_nCacheHits
number of kernel cache hits, used for printing statistics only
|
protected long |
m_nEvals
number of kernel evaluations, used for printing statistics only
|
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 SMOset |
m_supportVectors
The set of support vectors
|
protected double[] |
m_weights
Weight vector for linear machine.
|
| Constructor and Description |
|---|
BinarySMO() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildClassifier(Instances insts,
int cl1,
int cl2,
boolean fitCalibrator,
int numFolds,
int randomSeed)
Method for building the binary classifier.
|
protected void |
checkClassifier()
Quick and dirty check whether the quadratic programming problem is solved.
|
protected boolean |
examineExample(int i2)
Examines instance.
|
protected void |
fitCalibrator(Instances insts,
int cl1,
int cl2,
int numFolds,
java.util.Random random)
Fits calibrator model to SVM's output, so that reasonable probability estimates can be produced.
|
Kernel |
getKernel()
Returns the kernel to use
|
java.lang.String |
getRevision()
Returns the revision string.
|
void |
setKernel(Kernel value)
sets the kernel to use
|
double |
SVMOutput(int index,
Instance inst)
Computes SVM output for given instance.
|
protected boolean |
takeStep(int i1,
int i2,
double F2)
Method solving for the Lagrange multipliers for two instances.
|
java.lang.String |
toString()
Prints out the classifier.
|
protected double[] m_alpha
protected double m_b
protected double m_bLow
protected double m_bUp
protected int m_iLow
protected int m_iUp
protected Instances m_data
protected double[] m_weights
protected double[] m_sparseWeights
protected int[] m_sparseIndices
protected Kernel m_kernel
protected double[] m_class
protected double[] m_errors
protected SMOset m_I0
protected SMOset m_I1
protected SMOset m_I2
protected SMOset m_I3
protected SMOset m_I4
protected SMOset m_supportVectors
protected Classifier m_calibrator
protected Instances m_calibrationDataHeader
protected double m_sumOfWeights
protected long m_nEvals
protected int m_nCacheHits
protected void fitCalibrator(Instances insts, int cl1, int cl2, int numFolds, java.util.Random random) throws java.lang.Exception
insts - the set of training instancescl1 - the first class' indexcl2 - the second class' indexnumFolds - the number of folds for cross-validationrandom - for randomizing the datajava.lang.Exception - if the sigmoid can't be fit successfullypublic void setKernel(Kernel value)
value - the kernel to usepublic Kernel getKernel()
protected void buildClassifier(Instances insts, int cl1, int cl2, boolean fitCalibrator, int numFolds, int randomSeed) throws java.lang.Exception
insts - the set of training instancescl1 - the first class' indexcl2 - the second class' indexfitCalibrator - true if calibrator model is to be fitnumFolds - number of folds for internal cross-validationrandomSeed - random number generator for cross-validationjava.lang.Exception - if the classifier can't be built successfullypublic double SVMOutput(int index,
Instance inst)
throws java.lang.Exception
index - the instance for which output is to be computedinst - the instancejava.lang.Exception - in case of an errorpublic java.lang.String toString()
toString in class java.lang.Objectprotected boolean examineExample(int i2)
throws java.lang.Exception
i2 - index of instance to examinejava.lang.Exception - if something goes wrongprotected boolean takeStep(int i1,
int i2,
double F2)
throws java.lang.Exception
i1 - index of the first instancei2 - index of the second instanceF2 - java.lang.Exception - if something goes wrongprotected void checkClassifier()
throws java.lang.Exception
java.lang.Exception - if checking failspublic java.lang.String getRevision()