public class LSSVM extends SupportVectorLearner implements BinaryScoreClassifier, Regressor, Parameterized, WarmRegressor, WarmClassifier
PlattSMO
is used. This is done
because is can easily operate without explicitly forming the whole kernel
matrix. However it is recommended to use the LS-SVM when the problem size is
small enough such that SupportVectorLearner.CacheMode.FULL
can be
used. SupportVectorLearner.CacheMode
Modifier and Type | Field and Description |
---|---|
protected double |
b |
protected double |
b_low |
protected double |
b_up |
accelCache, alphas, cacheEvictions, evalCount, vecs
Constructor and Description |
---|
LSSVM()
Creates a new LS-SVM learner that uses a linear model and does not use a
cache
|
LSSVM(KernelTrick kernel)
Creates a new LS-SVM learner that does not use a cache
|
LSSVM(KernelTrick kernel,
SupportVectorLearner.CacheMode cacheMode)
Creates a new LS-SVM learner
|
LSSVM(LSSVM toCopy)
Creates a deep copy of another LS-SVM
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
LSSVM |
clone() |
double |
getC()
Returns the regularization parameter value used
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
double |
getScore(DataPoint dp)
Returns the numeric score for predicting a class of a given data point,
where the sign of the value indicates which class the data point is
predicted to belong to.
|
static Distribution |
guessC(DataSet d)
Guess the distribution to use for the regularization term
C in a LS-SVM. |
double |
regress(DataPoint data) |
void |
setC(double C)
Sets the regularization constant when training.
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
train(RegressionDataSet dataSet) |
void |
train(RegressionDataSet dataSet,
ExecutorService threadPool) |
void |
train(RegressionDataSet dataSet,
Regressor warmSolution)
Trains the regressor and constructs a model for regression using the
given data set.
|
void |
train(RegressionDataSet dataSet,
Regressor warmSolution,
ExecutorService threadPool)
Trains the regressor and constructs a model for regression using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
Classifier warmSolution)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
Classifier warmSolution,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
boolean |
warmFromSameDataOnly()
Some models can only be warm started from a solution trained on the
exact same data set as the model it is warm starting from.
|
accessingRow, getCacheMode, getCacheValue, getKernel, k, kEval, kEval, kEvalSum, setAlphas, setCacheMode, setCacheSize, setCacheValue, setKernel, sparsify
public LSSVM()
public LSSVM(KernelTrick kernel)
kernel
- the kernel method to usepublic LSSVM(KernelTrick kernel, SupportVectorLearner.CacheMode cacheMode)
kernel
- the kernel method to usecacheMode
- the caching scheme to use for kernel evaluationspublic LSSVM(LSSVM toCopy)
toCopy
- the object to copypublic void setC(double C)
C
- the positive regularization parameterpublic double getC()
public boolean warmFromSameDataOnly()
WarmRegressor
true
will be returned. The behavior for training on a
different data set when this is defined is undefined. It may cause an
error, or it may cause the algorithm to take longer or reach a worse
solution. true
, it is important that the data set be unaltered - this
includes mutating the values stored or re-arranging the data points
within the data set.warmFromSameDataOnly
in interface WarmClassifier
warmFromSameDataOnly
in interface WarmRegressor
true
if the algorithm can only be warm started from the
model trained on the exact same data set.public double getScore(DataPoint dp)
BinaryScoreClassifier
getScore
in interface BinaryScoreClassifier
dp
- the data point to predict the class label ofpublic CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onpublic void train(RegressionDataSet dataSet, Regressor warmSolution, ExecutorService threadPool)
WarmRegressor
train
in interface WarmRegressor
dataSet
- the data set to train onwarmSolution
- the solution to use to warm start this modelthreadPool
- the source of threads to use.public void train(RegressionDataSet dataSet, Regressor warmSolution)
WarmRegressor
train
in interface WarmRegressor
dataSet
- the data set to train onwarmSolution
- the solution to use to warm start this modelpublic void trainC(ClassificationDataSet dataSet, Classifier warmSolution, ExecutorService threadPool)
WarmClassifier
trainC
in interface WarmClassifier
dataSet
- the data set to train onwarmSolution
- the solution to use to warm start this modelthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet, Classifier warmSolution)
WarmClassifier
trainC
in interface WarmClassifier
dataSet
- the data set to train onwarmSolution
- the solution to use to warm start this modelpublic boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
supportsWeightedData
in interface Regressor
public void train(RegressionDataSet dataSet, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
public LSSVM clone()
clone
in interface BinaryScoreClassifier
clone
in interface Classifier
clone
in interface Regressor
clone
in class Object
public List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainpublic static Distribution guessC(DataSet d)
C
in a LS-SVM.d
- the data set to get the guess forCopyright © 2017. All rights reserved.