jsat.classifiers.svm.extended
Class OnlineAMM
- java.lang.Object
-
- jsat.classifiers.BaseUpdateableClassifier
-
- jsat.classifiers.svm.extended.OnlineAMM
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Classifier, UpdateableClassifier, Parameterized
- Direct Known Subclasses:
- AMM
public class OnlineAMM extends BaseUpdateableClassifier implements Parameterized
This is the Online variant of the Adaptive Multi-Hyperplane Machine (AMM) algorithm. It is related to linear SVMs where instead of having only a single weight vector, it is extended to multi-class problems by giving each class its own weight vector. It is further extended by allowing each class to dynamically add new weight vectors to increase the non-linearity of the solution.
This algorithm works best for problems with a very large number of data points where traditional kernelized SVMs are prohibitively expensive to train due to computational cost.
Unlike the batch variant, the online AMM algorithm has no convergence guarantees. However it still produces good results.
See:- Wang, Z., Djuric, N., Crammer, K., & Vucetic, S. (2011). Trading representability for scalability Adaptive Multi-Hyperplane Machine for nonlinear Classification. In Proceedings of the 17th ACM SIGKDD international conference on Knowledge discovery and data mining - KDD ’11 (p. 24). New York, New York, USA: ACM Press. doi:10.1145/2020408.2020420
- Djuric, N., Lan, L., Vucetic, S., & Wang, Z. (2014). BudgetedSVM: A Toolbox for Scalable SVM Approximations. Journal of Machine Learning Research, 14, 3813–3817. Retrieved from here
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intDEFAULT_CLASS_BUDGETThe defaultclass budgetis 50.static doubleDEFAULT_PRUNE_CONSTANTThe defaultpruning constantis 10.0.static intDEFAULT_PRUNE_FREQUENCYThe defaultfrequency for pruningis 10000.static doubleDEFAULT_REGULARIZERThe defaultregularization valueis 0.01.
-
Constructor Summary
Constructors Constructor and Description OnlineAMM()Creates a new online AMM learnerOnlineAMM(double lambda)Creates a new online AMM learnerOnlineAMM(double lambda, int classBudget)Creates a new online AMM learnerOnlineAMM(OnlineAMM toCopy)Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description CategoricalResultsclassify(DataPoint data)Performs classification on the given data point.OnlineAMMclone()doublegetC()Returns the pruning constantintgetClassBudget()Returns the maximum number of hyperplanes allowed per classdoublegetLambda()Returns the regularization parameterintgetPruneFrequency()Returns the number of iterations between each pruningstatic DistributionguessLambda(DataSet d)Guess the distribution to use for the regularization termλin AMM.voidsetC(double c)Sets the pruning constant which controls how powerful pruning is when pruning occurs.voidsetClassBudget(int classBudget)When given bad parameters there is the possibility for unbounded growth in the number of hyperplanes used.voidsetLambda(double lambda)Sets the regularization parameter for this algorithm.voidsetPruneFrequency(int frequency)Sets the frequency at which the weight vectors are pruned.voidsetUp(CategoricalData[] categoricalAttributes, int numericAttributes, CategoricalData predicting)Prepares the classifier to begin learning from itsUpdateableClassifier.update(jsat.classifiers.DataPoint, int)method.booleansupportsWeightedData()Indicates whether the model knows how to train using weighted data points.voidupdate(DataPoint dataPoint, int y_t)Updates the classifier by giving it a new data point to learn from.-
Methods inherited from class jsat.classifiers.BaseUpdateableClassifier
getEpochs, setEpochs, train, train, trainEpochs
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.parameters.Parameterized
getParameter, getParameters
-
-
-
-
Field Detail
-
DEFAULT_PRUNE_FREQUENCY
public static final int DEFAULT_PRUNE_FREQUENCY
The defaultfrequency for pruningis 10000.- See Also:
- Constant Field Values
-
DEFAULT_PRUNE_CONSTANT
public static final double DEFAULT_PRUNE_CONSTANT
The defaultpruning constantis 10.0.- See Also:
- Constant Field Values
-
DEFAULT_CLASS_BUDGET
public static final int DEFAULT_CLASS_BUDGET
The defaultclass budgetis 50.- See Also:
- Constant Field Values
-
DEFAULT_REGULARIZER
public static final double DEFAULT_REGULARIZER
The defaultregularization valueis 0.01.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OnlineAMM
public OnlineAMM()
Creates a new online AMM learner
-
OnlineAMM
public OnlineAMM(double lambda)
Creates a new online AMM learner- Parameters:
lambda- the regularization value to use
-
OnlineAMM
public OnlineAMM(double lambda, int classBudget)Creates a new online AMM learner- Parameters:
lambda- the regularization value to useclassBudget- the maximum number of weight vectors for each class
-
OnlineAMM
public OnlineAMM(OnlineAMM toCopy)
Copy constructor- Parameters:
toCopy- the object to copy
-
-
Method Detail
-
clone
public OnlineAMM clone()
- Specified by:
clonein interfaceClassifier- Specified by:
clonein interfaceUpdateableClassifier- Specified by:
clonein classBaseUpdateableClassifier
-
setLambda
public void setLambda(double lambda)
Sets the regularization parameter for this algorithm. The original paper suggests trying values 10-2, 10-3, ..., 10-6, 10-7.- Parameters:
lambda- the positive regularization parameter in (0, ∞)
-
getLambda
public double getLambda()
Returns the regularization parameter- Returns:
- the regularization parameter
-
setPruneFrequency
public void setPruneFrequency(int frequency)
Sets the frequency at which the weight vectors are pruned. Increasing the frequency increases the aggressiveness of pruning.- Parameters:
frequency- the number of iterations between each pruning
-
getPruneFrequency
public int getPruneFrequency()
Returns the number of iterations between each pruning- Returns:
- the number of iterations between each pruning
-
setC
public void setC(double c)
Sets the pruning constant which controls how powerful pruning is when pruning occurs. Increasing C increases how many weights will be pruned. Changes to the scaling of feature vectors may require a change in the value of C
NOTE: This parameter is not the same as the standard C parameter associated with SVMs.- Parameters:
c- the positive pruning constant to use in (0, ∞)
-
getC
public double getC()
Returns the pruning constant- Returns:
- the pruning constant
-
setClassBudget
public void setClassBudget(int classBudget)
When given bad parameters there is the possibility for unbounded growth in the number of hyperplanes used. By setting this value to a reasonable upperbound catastrophic memory and CPU use can be avoided.- Parameters:
classBudget- the maximum number of hyperplanes allowed per class
-
getClassBudget
public int getClassBudget()
Returns the maximum number of hyperplanes allowed per class- Returns:
- the maximum number of hyperplanes allowed per class
-
setUp
public void setUp(CategoricalData[] categoricalAttributes, int numericAttributes, CategoricalData predicting)
Description copied from interface:UpdateableClassifierPrepares the classifier to begin learning from itsUpdateableClassifier.update(jsat.classifiers.DataPoint, int)method.- Specified by:
setUpin interfaceUpdateableClassifier- Parameters:
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 predicted
-
update
public void update(DataPoint dataPoint, int y_t)
Description copied from interface:UpdateableClassifierUpdates the classifier by giving it a new data point to learn from.- Specified by:
updatein interfaceUpdateableClassifier- Parameters:
dataPoint- the data point to learny_t- the target class of the data point
-
classify
public CategoricalResults classify(DataPoint data)
Description copied from interface:ClassifierPerforms classification on the given data point.- Specified by:
classifyin interfaceClassifier- Parameters:
data- the data point to classify- Returns:
- the results of the classification.
-
supportsWeightedData
public boolean supportsWeightedData()
Description copied from interface:ClassifierIndicates whether the model knows how to train using weighted data points. If it does, the model will train assuming the weights. The values returned by this method may change depending on the parameters set for the model.- Specified by:
supportsWeightedDatain interfaceClassifier- Returns:
- true if the model supports weighted data, false otherwise
-
guessLambda
public static Distribution guessLambda(DataSet d)
Guess the distribution to use for the regularization termλin AMM.- Parameters:
d- the data set to get the guess for- Returns:
- the guess for the λ parameter
-
-
DataMelt 3.0 © DataMelt by jWork.ORG