public class CPM extends Object implements BinaryScoreClassifier, Classifier, Parameterized
AMM
classifier, CPM uses multiple linear
hyper-planes to create a non-linear classifier. Increasing the number of
hyper-planes increases training/prediction time, but also increases the
amount of non-linearity the model can tolerate.BinaryScoreClassifier
interface, the CPM
decision algorithm does not completely lend itself to producing a natural
score in this manner. For this reason you may observe unusual behavior from
the CPM if you rely on this interface, compared with other approaches.
Constructor and Description |
---|
CPM()
Creates a new CPM classifier, with default parameters that should work
well for most cases.
|
CPM(CPM toCopy)
Copy constructor
|
CPM(double lambda)
Creates a new CPM classifier
|
CPM(double lambda,
int K)
Creates a new CPM classifier
|
CPM(double lambda,
int K,
double entropyThreshold)
Creates a new CPM classifier
|
CPM(double lambda,
int K,
double entropyThreshold,
int epochs)
Creates a new CPM classifier
|
CPM(int K)
Creates a new CPM classifier
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
CPM |
clone() |
double |
getEntropyThreshold() |
int |
getEpochs()
Returns the number of epochs used for training
|
int |
getK() |
double |
getLambda() |
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 |
guessEntropyThreshold(DataSet d)
Provides a distribution of reasonable values for the
setEntropyThreshold(double) parameter |
static Distribution |
guessLambda(DataSet d)
Provides a distribution of reasonable values for the
λ parameter |
void |
setEntropyThreshold(double entropyThreshold)
Sets the entropy threshold used for training.
|
void |
setEpochs(int epochs)
Sets the number of whole iterations through the training set that will be
performed for training
|
void |
setK(int K)
Sets the number of hyper planes to use when training.
|
void |
setLambda(double lambda)
Sets the regularization parameter λ to use.
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
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 CPM()
public CPM(int K)
K
- the number of hyper-planes to learn with.public CPM(double lambda)
lambda
- the regularization parameterpublic CPM(double lambda, int K)
lambda
- the regularization parameterK
- the number of hyper-planes to learn with.public CPM(double lambda, int K, double entropyThreshold)
lambda
- the regularization parameterK
- the number of hyper-planes to learn with.entropyThreshold
- the parameter that encourages non-linearity to be exploitedpublic CPM(double lambda, int K, double entropyThreshold, int epochs)
lambda
- the regularization parameterK
- the number of hyper-planes to learn with.entropyThreshold
- the parameter that encourages non-linearity to be exploitedepochs
- the number of training iterationspublic CPM(CPM toCopy)
toCopy
- the object to copypublic void setEntropyThreshold(double entropyThreshold)
entropyThreshold
- the non-negative parameter for hyper-plane diversitypublic double getEntropyThreshold()
public void setLambda(double lambda)
lambda
- the regularization parameter value to use, the recommended
range range is (0, 104]public double getLambda()
public void setK(int K)
K
- the number of hyper planes to use.public int getK()
public void setEpochs(int epochs)
epochs
- the number of whole iterations through the data setpublic int getEpochs()
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 boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
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 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 CPM clone()
clone
in interface BinaryScoreClassifier
clone
in interface Classifier
clone
in class Object
public static Distribution guessLambda(DataSet d)
λ
parameterd
- the dataset to get the guess forpublic static Distribution guessEntropyThreshold(DataSet d)
setEntropyThreshold(double)
parameterd
- the dataset to get the guess forCopyright © 2017. All rights reserved.