public class ALMA2 extends BaseUpdateableClassifier implements BinaryScoreClassifier, SingleWeightVectorModel
alpha
to be set,
the other two have default behavior / values that have provable convergence.
Modifier | Constructor and Description |
---|---|
|
ALMA2()
Creates a new ALMA learner using an alpha of 0.8
|
protected |
ALMA2(ALMA2 other)
Copy constructor
|
|
ALMA2(double alpha)
Creates a new ALMA learner using the given alpha
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
ALMA2 |
clone() |
double |
getAlpha()
Returns the approximation coefficient used
|
double |
getB()
Returns the B value of the ALMA algorithm
|
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() |
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.
|
Vec |
getWeightVec()
Returns the weight vector used to compute results via a dot product.
|
boolean |
isUseBias()
Returns whether or not an implicit bias term is in use
|
int |
numWeightsVecs()
Returns the number of weight vectors that can be returned.
|
void |
setAlpha(double alpha)
Alpha controls the approximation of the large margin formed by ALMA,
with larger values causing more updates.
|
void |
setB(double B)
Sets the B variable of the ALMA algorithm, this is set automatically by
setAlpha(double) . |
void |
setC(double C)
Sets the C value of the ALMA algorithm.
|
void |
setUp(CategoricalData[] categoricalAttributes,
int numericAttributes,
CategoricalData predicting)
Prepares the classifier to begin learning from its
UpdateableClassifier.update(jsat.classifiers.DataPoint, int) method. |
void |
setUseBias(boolean useBias)
Sets whether or not an implicit bias term will be added to the data set
|
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 ALMA2()
public ALMA2(double alpha)
alpha
- the alpha value to usesetAlpha(double)
protected ALMA2(ALMA2 other)
other
- the object to copypublic Vec getWeightVec()
public void setAlpha(double alpha)
B
will
also be set to an appropriate value. This is not the only possible value
that will lead to convergence, and can be set manually after alpha is set
to another value.alpha
- the approximation scale in (0.0, 1.0]public double getAlpha()
public void setB(double B)
setAlpha(double)
.B
- the value for Bpublic double getB()
public void setC(double C)
C
- the C value of ALMApublic double getC()
public void setUseBias(boolean useBias)
useBias
- true
to add an implicit bias termpublic boolean isUseBias()
true
if a bias term is in usepublic ALMA2 clone()
clone
in interface BinaryScoreClassifier
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 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 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.Copyright © 2017. All rights reserved.