public class SMOreg extends java.lang.Object implements WeightedInstancesHandler, TechnicalInformationHandler
@incollection{Smola1998, author = {Alex J. Smola and Bernhard Schoelkopf}, booktitle = {NeuroCOLT2 Technical Report Series}, note = {NC2-TR-1998-030}, title = {A Tutorial on Support Vector Regression}, year = {1998} } @techreport{Shevade1999, address = {Control Division Dept of Mechanical and Production Engineering, National University of Singapore}, author = {S.K. Shevade and S.S. Keerthi and C. Bhattacharyya and K.R.K. Murthy}, institution = {National University of Singapore}, note = {Technical Report CD-99-16}, title = {Improvements to SMO Algorithm for SVM Regression}, year = {1999} }Valid options are:
-D If set, classifier is run in debug mode and may output additional info to the console
-no-checks Turns off all checks - use with caution! Turning them off assumes that data is purely numeric, doesn't contain any missing values, and has a nominal class. Turning them off also means that no header information will be stored if the machine is linear. Finally, it also assumes that no instance has a weight equal to 0. (default: checks on)
-S <double> The amount up to which deviations are tolerated (epsilon). (default 1e-3)
-C <double> The complexity constant C. (default 1)
-N Whether to 0=normalize/1=standardize/2=neither. (default 0=normalize)
-T <double> The tolerance parameter. (default 1.0e-3)
-P <double> The epsilon for round-off error. (default 1.0e-12)
-K <classname and parameters> The Kernel to use. (default: weka.classifiers.functions.supportVector.PolyKernel)
Options specific to kernel weka.classifiers.functions.supportVector.PolyKernel:
-D Enables debugging output (if available) to be printed. (default: off)
-no-checks Turns off all checks - use with caution! (default: checks on)
-C <num> The size of the cache (a prime number). (default: 250007)
-E <num> The Exponent to use. (default: 1.0)
-L Use lower-order terms. (default: no)
Modifier and Type | Field and Description |
---|---|
static int |
FILTER_NONE
no filtering
|
static int |
FILTER_NORMALIZE
normalize data
|
static int |
FILTER_STANDARDIZE
standardize data
|
protected double |
m_Alin
The parameters of the linear transforamtion realized
by the filter on the class attribute
|
protected double[] |
m_alpha
The Lagrange multipliers
|
protected double[] |
m_alpha_
The Lagrange multipliers
|
protected double |
m_b
The thresholds.
|
protected double |
m_Blin
The parameters of the linear transforamtion realized
by the filter on the class attribute
|
protected double |
m_bLow
The thresholds.
|
protected double |
m_bUp
The thresholds.
|
protected double |
m_C
The complexity parameter
|
protected boolean |
m_checksTurnedOff
Turn off all checks and conversions?
|
protected int |
m_classIndex
The class index from the training data
|
protected Instances |
m_data
The training data.
|
protected static double |
m_Del
Precision constant for updating sets
|
protected double |
m_eps
The parameter eps
|
protected double |
m_epsilon
The parameter epsilon
|
protected double[] |
m_fcache
The current set of errors for all non-bound examples.
|
protected int |
m_filterType
Whether to normalize/standardize/neither
|
protected SMOset |
m_I0
{i: 0 < m_alpha[i] < C || 0 < m_alpha_[i] < C}
|
protected SMOset |
m_I1
{i: m_class[i] = 0, m_alpha_[i] = 0}
|
protected SMOset |
m_I2
{i: m_class[i] = 0, m_alpha_[i] = C}
|
protected SMOset |
m_I3
{i: m_class[i] = C, 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 boolean |
m_KernelIsLinear
whether the kernel is a linear one
|
protected int[] |
m_sparseIndices
Variables to hold indices vector in sparse form.
|
protected double[] |
m_sparseWeights
Variables to hold weight vector in sparse form.
|
protected double |
m_tol
The parameter tol
|
protected double[] |
m_weights
Weight vector for linear machine.
|
static Tag[] |
TAGS_FILTER
The filter to apply to the training data
|
Constructor and Description |
---|
SMOreg() |
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances insts)
Method for building the classifier.
|
protected void |
checkAlphas()
Debuggage function
Checks that : alpha*alpha_=0 sum(alpha[i] - alpha_[i]) = 0 |
protected void |
checkOptimality()
Debuggage function.
|
protected void |
checkSets()
Debuggage function.
|
java.lang.String |
checksTurnedOffTipText()
Returns the tip text for this property
|
double |
classifyInstance(Instance inst)
Classifies a given instance.
|
java.lang.String |
cTipText()
Returns the tip text for this property
|
protected void |
displayB()
Debuggage function
Compute and display bLow, lUp and so on...
|
protected void |
displayStat(int i1,
int i2)
Debuggage function.
|
java.lang.String |
epsilonTipText()
Returns the tip text for this property
|
java.lang.String |
epsTipText()
Returns the tip text for this property
|
protected int |
examineExample(int i2)
Examines instance.
|
java.lang.String |
filterTypeTipText()
Returns the tip text for this property
|
double |
getC()
Get the value of C.
|
boolean |
getChecksTurnedOff()
Returns whether the checks are turned off or not.
|
double |
getEps()
Get the value of eps.
|
double |
getEpsilon()
Get the value of epsilon.
|
SelectedTag |
getFilterType()
Gets how the training data will be transformed.
|
Kernel |
getKernel()
Gets the kernel to use.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
double |
getToleranceParameter()
Get the value of tolerance parameter.
|
java.lang.String |
globalInfo()
Returns a string describing classifier
|
java.lang.String |
kernelTipText()
Returns the tip text for this property
|
protected double |
objFun()
Debuggage function.
|
protected double |
objFun(int i1,
int i2,
double alpha1,
double alpha1_,
double alpha2,
double alpha2_)
Debuggage function.
|
void |
setC(double v)
Set the value of C.
|
void |
setChecksTurnedOff(boolean value)
Disables or enables the checks (which could be time-consuming).
|
void |
setEps(double v)
Set the value of eps.
|
void |
setEpsilon(double v)
Set the value of epsilon.
|
void |
setFilterType(SelectedTag newType)
Sets how the training data will be transformed.
|
void |
setKernel(Kernel value)
Sets the kernel to use.
|
void |
setToleranceParameter(double v)
Set the value of tolerance parameter.
|
protected boolean |
takeStep(int i1,
int i2)
Method solving for the Lagrange multipliers for
two instances.
|
java.lang.String |
toleranceParameterTipText()
Returns the tip text for this property
|
void |
turnChecksOff()
Turns off checks for missing values, etc.
|
void |
turnChecksOn()
Turns on checks for missing values, etc.
|
protected Kernel m_kernel
protected int m_classIndex
public static final int FILTER_NORMALIZE
public static final int FILTER_STANDARDIZE
public static final int FILTER_NONE
public static final Tag[] TAGS_FILTER
protected int m_filterType
protected boolean m_checksTurnedOff
protected Instances m_data
protected double m_C
protected double[] m_alpha
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 double[] m_weights
protected double[] m_fcache
protected SMOset m_I0
protected SMOset m_I1
protected SMOset m_I2
protected SMOset m_I3
protected double m_epsilon
protected double m_tol
protected double m_eps
protected static double m_Del
protected double m_Alin
protected double m_Blin
protected double[] m_sparseWeights
protected int[] m_sparseIndices
protected boolean m_KernelIsLinear
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public void buildClassifier(Instances insts) throws java.lang.Exception
insts
- the set of training instancesjava.lang.Exception
- if the classifier can't be built successfullyprotected int 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) throws java.lang.Exception
i1
- index of the first instancei2
- index of the second instancejava.lang.Exception
- if something goes wrongpublic double classifyInstance(Instance inst) throws java.lang.Exception
inst
- the instance to be classifiedjava.lang.Exception
- if instance could not be classified
successfullypublic void setChecksTurnedOff(boolean value)
value
- if true turns off all checkspublic boolean getChecksTurnedOff()
public java.lang.String checksTurnedOffTipText()
public java.lang.String kernelTipText()
public Kernel getKernel()
public void setKernel(Kernel value)
value
- the kernelpublic java.lang.String filterTypeTipText()
public SelectedTag getFilterType()
public void setFilterType(SelectedTag newType)
newType
- the new filtering modepublic java.lang.String cTipText()
public double getC()
public void setC(double v)
v
- Value to assign to C.public java.lang.String toleranceParameterTipText()
public double getToleranceParameter()
public void setToleranceParameter(double v)
v
- Value to assign to tolerance parameter.public java.lang.String epsTipText()
public double getEps()
public void setEps(double v)
v
- Value to assign to epsilon.public java.lang.String epsilonTipText()
public double getEpsilon()
public void setEpsilon(double v)
v
- Value to assign to epsilon.public void turnChecksOff()
public void turnChecksOn()
protected double objFun() throws java.lang.Exception
java.lang.Exception
- if computation failsprotected double objFun(int i1, int i2, double alpha1, double alpha1_, double alpha2, double alpha2_) throws java.lang.Exception
i1
- objetive function index 1.i2
- objetive function index 2.alpha1
- objetive function alpha value 1.alpha1_
- objetive function alpha value 1.alpha2
- objetive function alpha value 2.alpha2_
- objetive function alpha value 2.java.lang.Exception
- if something goes wrongprotected void checkSets() throws java.lang.Exception
java.lang.Exception
- if check failsprotected void checkAlphas() throws java.lang.Exception
java.lang.Exception
- if check failsprotected void displayStat(int i1, int i2) throws java.lang.Exception
i1
- the first current indicei2
- the second current indicejava.lang.Exception
- if printing of current status failsprotected void displayB() throws java.lang.Exception
java.lang.Exception
- if display failsprotected void checkOptimality() throws java.lang.Exception
java.lang.Exception
- if check fails