public class CSKLR extends BaseUpdateableClassifier implements Parameterized
learning rate
and gamma
variables. They behave different compared to many algorithms.
batch version
of this algorithm should be used instead.
Modifier and Type | Class and Description |
---|---|
static class |
CSKLR.UpdateMode
Controls when updates are performed on the model.
|
Modifier | Constructor and Description |
---|---|
protected |
CSKLR(CSKLR toClone)
Copy constructor
|
|
CSKLR(double eta,
KernelTrick k,
double R,
CSKLR.UpdateMode mode)
Creates a new CSKLR object
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
CSKLR |
clone() |
double |
getEta()
Returns the learning rate to use
|
double |
getGamma()
Returns the gamma sparsity parameter value
|
KernelTrick |
getKernel()
Returns the kernel trick in use
|
CSKLR.UpdateMode |
getMode()
Returns the update mode in use
|
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 |
getR()
Returns the maximal norm of the algorithm
|
protected static double |
getScore(double y,
double pre)
Returns the binary logistic regression score
|
static Distribution |
guessR(DataSet d)
Guesses the distribution to use for the R parameter
|
void |
setEta(double eta)
Sets the learning rate to use for the algorithm.
|
void |
setGamma(double gamma)
Sets the gamma value to use.
|
void |
setKernel(KernelTrick k)
Set which kernel trick to use
|
void |
setMode(CSKLR.UpdateMode mode)
Sets what update mode should be used.
|
void |
setR(double R)
Sets the maximal margin norm value for the algorithm.
|
void |
setUp(CategoricalData[] categoricalAttributes,
int numericAttributes,
CategoricalData predicting)
Prepares the classifier to begin learning from its
UpdateableClassifier.update(jsat.classifiers.DataPoint, int) method. |
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
update(DataPoint dataPoint,
int targetClass)
Updates the classifier by giving it a new data point to learn from.
|
getEpochs, setEpochs, trainC, trainC, trainEpochs
public CSKLR(double eta, KernelTrick k, double R, CSKLR.UpdateMode mode)
eta
- the learning rate to usek
- the kernel trick to useR
- the maximal norm of the surfacemode
- the mode to useprotected CSKLR(CSKLR toClone)
toClone
- the object to copypublic static Distribution guessR(DataSet d)
d
- the dataset to get the guess forsetR(double)
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 setEta(double eta)
eta
- the positive learning rate to usepublic double getEta()
public void setR(double R)
R
- public double getR()
public void setMode(CSKLR.UpdateMode mode)
setGamma(double)
mode
- the update mode to usepublic CSKLR.UpdateMode getMode()
public void setGamma(double gamma)
CSKLR.UpdateMode
is used, controls the sparsity of the model.gamma
- the gamma parameter, which is at least always positivepublic double getGamma()
public void setKernel(KernelTrick k)
k
- the kernel to usepublic KernelTrick getKernel()
protected static double getScore(double y, double pre)
y
- the sign of the desired class (-1 or 1)pre
- the raw coefficient scorepublic CSKLR clone()
clone
in interface Classifier
clone
in interface UpdateableClassifier
clone
in class BaseUpdateableClassifier
public void setUp(CategoricalData[] categoricalAttributes, int numericAttributes, CategoricalData predicting)
UpdateableClassifier
UpdateableClassifier.update(jsat.classifiers.DataPoint, int)
method.setUp
in interface UpdateableClassifier
categoricalAttributes
- an array containing the categorical
attributes that will be in each data pointnumericAttributes
- the number of numeric attributes that will be in
each data pointpredicting
- the information for the target class that will be
predictedpublic void update(DataPoint dataPoint, int targetClass)
UpdateableClassifier
update
in interface UpdateableClassifier
dataPoint
- the data point to learntargetClass
- the target class of the data pointpublic CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
Copyright © 2017. All rights reserved.