public class RegOptimizer extends java.lang.Object implements OptionHandler, java.io.Serializable
-L <double> The epsilon parameter in epsilon-insensitive loss function. (default 1.0e-3)
-W <double> The random number seed. (default 1)
Modifier and Type | Field and Description |
---|---|
double[] |
m_alpha
alpha and alpha* arrays containing weights for solving dual problem
|
double[] |
m_alphaStar
alpha and alpha* arrays containing weights for solving dual problem
|
protected double |
m_b
offset
|
protected boolean |
m_bModelBuilt
flag to indicate whether the model is built yet
|
protected double |
m_C
capacity parameter, copied from SVMreg
|
protected int |
m_classIndex
index of class variable in data set
|
protected Instances |
m_data
points to data set
|
protected double |
m_epsilon
epsilon of epsilon-insensitive cost function
|
protected Kernel |
m_kernel
the kernel
|
protected int |
m_nCacheHits
number of kernel cache hits, used for printing statistics only
|
protected int |
m_nEvals
number of kernel evaluations, used for printing statistics only
|
protected int |
m_nInstances
number of instances in data set
|
protected int |
m_nSeed
seed for initializing random number generator
|
protected java.util.Random |
m_random
random number generator
|
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 SMOset |
m_supportVectors
set of support vectors, that is, vectors with alpha(*)!
|
protected SVMreg |
m_SVM
parent SVMreg class
|
protected double[] |
m_target
class values/desired output vector
|
protected double[] |
m_weights
weights for linear kernel
|
Constructor and Description |
---|
RegOptimizer()
the default constructor
|
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(Instances data)
learn SVM parameters from data.
|
java.lang.String |
epsilonParameterTipText()
Returns the tip text for this property
|
int |
getCacheHits()
return the number of kernel cache hits
|
double |
getEpsilonParameter()
Get the value of epsilon parameter of the epsilon insensitive loss function.
|
int |
getKernelEvaluations()
returns the number of kernel evaluations
|
java.lang.String[] |
getOptions()
Gets the current settings of the classifier.
|
protected double |
getScore()
Compute the value of the objective function.
|
int |
getSeed()
Gets the current seed value for the random number generator
|
protected void |
init(Instances data)
initializes the algorithm
|
java.util.Enumeration |
listOptions()
Gets an enumeration describing the available options.
|
boolean |
modelBuilt()
flag to indicate whether the model was built yet
|
java.lang.String |
seedTipText()
Returns the tip text for this property
|
void |
setEpsilonParameter(double v)
Set the value of epsilon parameter of the epsilon insensitive loss function.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setSeed(int value)
Sets the seed value for the random number generator
|
void |
setSVMReg(SVMreg value)
sets the parent SVM
|
double |
SVMOutput(Instance inst) |
protected double |
SVMOutput(int index)
SVMOutput of an instance in the training set, m_data
This uses the cache, unlike SVMOutput(Instance)
|
protected void |
wrapUp()
wrap up various variables to save memeory and do some housekeeping after optimization
has finished.
|
public double[] m_alpha
public double[] m_alphaStar
protected double m_b
protected double m_epsilon
protected double m_C
protected double[] m_target
protected Instances m_data
protected Kernel m_kernel
protected int m_classIndex
protected int m_nInstances
protected java.util.Random m_random
protected int m_nSeed
protected SMOset m_supportVectors
protected int m_nEvals
protected int m_nCacheHits
protected double[] m_weights
protected double[] m_sparseWeights
protected int[] m_sparseIndices
protected boolean m_bModelBuilt
protected SVMreg m_SVM
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-L <double> The epsilon parameter in epsilon-insensitive loss function. (default 1.0e-3)
-W <double> The random number seed. (default 1)
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public boolean modelBuilt()
public void setSVMReg(SVMreg value)
value
- the parent SVMpublic int getKernelEvaluations()
public int getCacheHits()
protected void init(Instances data) throws java.lang.Exception
data
- the data to work withjava.lang.Exception
- if m_SVM is nullprotected void wrapUp() throws java.lang.Exception
java.lang.Exception
- if something goes wrongprotected double getScore() throws java.lang.Exception
java.lang.Exception
- if something goes wrongpublic void buildClassifier(Instances data) throws java.lang.Exception
data
- the data to work withjava.lang.Exception
- always an Exceoption since subclasses must override itprotected double SVMOutput(int index) throws java.lang.Exception
index
- index of the training instance in m_datajava.lang.Exception
- if something goes wrongpublic double SVMOutput(Instance inst) throws java.lang.Exception
inst
- java.lang.Exception
public java.lang.String seedTipText()
public int getSeed()
public void setSeed(int value)
value
- the seed valuepublic java.lang.String epsilonParameterTipText()
public double getEpsilonParameter()
public void setEpsilonParameter(double v)
v
- Value to assign to epsilon parameter.