public class OSKL extends BaseUpdateableClassifier implements BinaryScoreClassifier, Parameterized
G
and a specified
loss function
. The number of support vectors is bounded by the
cumulative loss of the loss function used. logistic loss
. However, it can work with non-smooth
loss functions such as the hinge loss
. Constructor and Description |
---|
OSKL(KernelTrick k,
double R)
Creates a new OSKL learner using the
LogisticLoss . |
OSKL(KernelTrick k,
double eta,
double G,
double R)
Creates a new OSKL learner using the
LogisticLoss |
OSKL(KernelTrick k,
double eta,
double G,
double R,
LossC lossC)
Creates a new OSKL learner
|
OSKL(OSKL toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
OSKL |
clone() |
int |
getBurnIn()
Returns the number of burn in rounds
|
double |
getEta()
Returns the learning rate in use
|
double |
getG()
Returns the sparsification parameter
|
KernelTrick |
getKernel()
Returns the kernel to 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 maximum allowed norm for the model learned
|
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.
|
int |
getSupportVectorCount()
Returns the number of data points accepted as support vectors
|
static Distribution |
guessR(DataSet d)
Guesses the distribution to use for the R parameter
|
boolean |
isUseAverageModel()
Returns
true if the average of all models is being used, or
false if the last model is used |
void |
setBurnIn(int burnIn)
Sets the number of update calls to consider as part of the "burn in"
phase.
|
void |
setEta(double eta)
Sets the learning rate to use for training.
|
void |
setG(double G)
Sets the sparsification parameter G.
|
void |
setKernel(KernelTrick k)
Sets the kernel to use
|
void |
setR(double R)
Sets the maximum allowed norm of the model.
|
void |
setUp(CategoricalData[] categoricalAttributes,
int numericAttributes,
CategoricalData predicting)
Prepares the classifier to begin learning from its
UpdateableClassifier.update(jsat.classifiers.DataPoint, int) method. |
void |
setUseAverageModel(boolean useAverageModel)
Sets whether or not the average of all intermediate models is used or if
the most recent model is used when performing classification
|
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
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
trainC, trainC
public OSKL(KernelTrick k, double R)
LogisticLoss
. The parameters
setG(double)
and setEta(double)
are set based on the
original papers suggestions to produced a less sparse model that should
be more accuratek
- the kernel to useR
- the maximum allowed norm for the modelpublic OSKL(KernelTrick k, double eta, double G, double R)
LogisticLoss
k
- the kernel to useeta
- the learning rate to useG
- the sparsification parameterR
- the maximum allowed norm for the modelpublic OSKL(KernelTrick k, double eta, double G, double R, LossC lossC)
k
- the kernel to useeta
- the learning rate to useG
- the sparsification parameterR
- the maximum allowed norm for the modellossC
- the loss function to usepublic OSKL(OSKL toCopy)
toCopy
- the object to copypublic void setKernel(KernelTrick k)
k
- the kernel to usepublic KernelTrick getKernel()
public void setEta(double eta)
G
eta
- the positive learning rate to usepublic double getEta()
public void setG(double G)
G
- the sparsification parameter in [1, ∞)public double getG()
public static Distribution guessR(DataSet d)
d
- the dataset to get the guess forsetR(double)
public void setR(double R)
R
- the maximum allowed norm for the modelpublic double getR()
public void setUseAverageModel(boolean useAverageModel)
useAverageModel
- true
to use the average model,
false
to use the last model updatepublic boolean isUseAverageModel()
true
if the average of all models is being used, or
false
if the last model is usedtrue
if the average of all models is being used, or
false
if the last model is usedpublic void setBurnIn(int burnIn)
burnIn
- the number of updates to ignore before averaging. Must be
non negative.public int getBurnIn()
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 int getSupportVectorCount()
public 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
public double getScore(DataPoint dp)
BinaryScoreClassifier
getScore
in interface BinaryScoreClassifier
dp
- the data point to predict the class label ofpublic OSKL clone()
clone
in interface BinaryScoreClassifier
clone
in interface Classifier
clone
in interface UpdateableClassifier
clone
in class BaseUpdateableClassifier
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.