public class DCD extends Object implements BinaryScoreClassifier, Regressor, Parameterized, SingleWeightVectorModel
DCDs
,
Serialized FormConstructor and Description |
---|
DCD()
Creates a new DCDL2 SVM object
|
DCD(int maxIterations,
boolean useL1)
Creates a new DCD SVM object.
|
DCD(int maxIterations,
double C,
boolean useL1)
Creates a new DCD SVM object
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
DCD |
clone() |
double |
getBias()
Returns the bias term used for the model, or 0 of the model does not
support or was not trained with a bias term.
|
double |
getBias(int index)
Returns the bias term used with the weight vector for the given class
index.
|
double |
getC()
Returns the penalty parameter for misclassifications.
|
double |
getEps()
Returns the epsilon insensitivity parameter used in regression problems.
|
int |
getMaxIterations()
Returns the maximum number of allowed training epochs
|
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.
|
Vec |
getRawWeight()
Returns the only weight vector used for the model
|
Vec |
getRawWeight(int index)
Returns the raw weight vector associated with the given class index.
|
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.
|
boolean |
isOnlineVersion()
Returns whether or not the online version of the algorithm,
algorithm 2 is in use.
|
boolean |
isUseBias()
Returns
true if an implicit bias term is in use, or false
if not. |
boolean |
isUseL1()
Returns true if the L1 form is in use
|
int |
numWeightsVecs()
Returns the number of weight vectors that can be returned.
|
double |
regress(DataPoint data) |
void |
setC(double C)
Sets the penalty parameter for misclassifications.
|
void |
setEps(double eps)
Sets the
eps used in the epsilon insensitive loss function used
when performing regression. |
void |
setMaxIterations(int maxIterations)
Sets the maximum number of iterations allowed through the whole training
set.
|
void |
setOnlineVersion(boolean onlineVersion)
By default, Algorithm 1 is used.
|
void |
setUseBias(boolean useBias)
Sets whether or not an implicit bias term should be added to the inputs.
|
void |
setUseL1(boolean useL1)
Determines whether or not to use the L1 or L2 SVM
|
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 |
trainC(ClassificationDataSet dataSet)
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.
|
public DCD()
public DCD(int maxIterations, boolean useL1)
maxIterations
- the maximum number of training iterationsuseL1
- whether or not to use L1 or L2 formpublic DCD(int maxIterations, double C, boolean useL1)
maxIterations
- the maximum number of training iterationsC
- the misclassification penaltyuseL1
- whether or not to use L1 or L2 formpublic void setOnlineVersion(boolean onlineVersion)
onlineVersion
- false to use algorithm 1, true
to use algorithm 2public boolean isOnlineVersion()
public void setEps(double eps)
eps
used in the epsilon insensitive loss function used
when performing regression. Errors in the output that less than
eps
during training are treated as correct.
eps
- the non-negative value to use as the error tolerance in regressionpublic double getEps()
public void setC(double C)
C
- the penalty parameter in (0, Inf)public double getC()
public void setUseL1(boolean useL1)
useL1
- true to use the L1 form, false to use the L2 form.public boolean isUseL1()
public void setMaxIterations(int maxIterations)
maxIterations
- the maximum number of training epochspublic int getMaxIterations()
public void setUseBias(boolean useBias)
useBias
- true
to add an implicit bias term to inputs,
false
to use the input data as provided.public boolean isUseBias()
true
if an implicit bias term is in use, or false
if not.true
if an implicit bias term is in use, or false
if not.public Vec getRawWeight()
SingleWeightVectorModel
getRawWeight
in interface SingleWeightVectorModel
public double getBias()
SingleWeightVectorModel
getBias
in interface SingleWeightVectorModel
public Vec getRawWeight(int index)
SimpleWeightVectorModel
ConstantVector
object may be returned. index = 0
should be usedgetRawWeight
in interface SimpleWeightVectorModel
index
- the class index to get the weight vector forpublic double getBias(int index)
SimpleWeightVectorModel
0
will be returned.index = 0
should be usedgetBias
in interface SimpleWeightVectorModel
index
- the class index to get the weight vector forpublic int numWeightsVecs()
SimpleWeightVectorModel
numWeightsVecs
in interface SimpleWeightVectorModel
SimpleWeightVectorModel.getRawWeight(int)
can be called.public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic double getScore(DataPoint dp)
BinaryScoreClassifier
getScore
in interface BinaryScoreClassifier
dp
- the data point to predict the class label ofpublic 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, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
public boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
supportsWeightedData
in interface Regressor
public DCD 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 obtainCopyright © 2017. All rights reserved.