public class SPegasos extends Classifier implements TechnicalInformationHandler, UpdateableClassifier, OptionHandler
@inproceedings{Shalev-Shwartz2007,
author = {S. Shalev-Shwartz and Y. Singer and N. Srebro},
booktitle = {24th International Conference on MachineLearning},
pages = {807-814},
title = {Pegasos: Primal Estimated sub-GrAdient SOlver for SVM},
year = {2007}
}
Valid options are:
-L <double> The lambda regularization constant (default = 0.0001)
-E <integer> The number of epochs to perform (batch learning only, default = 500)
-N Don't normalize the data
-M Don't replace missing values
| Modifier and Type | Field and Description |
|---|---|
static Tag[] |
TAGS_SELECTION
Loss functions to choose from
|
| Constructor and Description |
|---|
SPegasos() |
| Modifier and Type | Method and Description |
|---|---|
void |
buildClassifier(Instances data)
Method for building the classifier.
|
double[] |
distributionForInstance(Instance inst)
Computes the distribution for a given instance
|
java.lang.String |
dontNormalizeTipText()
Returns the tip text for this property
|
java.lang.String |
dontReplaceMissingTipText()
Returns the tip text for this property
|
java.lang.String |
epochsTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
boolean |
getDontNormalize()
Get whether normalization has been turned off.
|
boolean |
getDontReplaceMissing()
Get whether global replacement of missing values has been
disabled.
|
int |
getEpochs()
Get current number of epochs
|
double |
getLambda()
Get the current value of lambda
|
SelectedTag |
getLossFunction()
Get the current loss function.
|
java.lang.String[] |
getOptions()
Gets the current settings of the classifier.
|
java.lang.String |
getRevision()
Returns the revision string.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing
detailed information about the technical background of this class,
e.g., paper reference or book this class is based on.
|
java.lang.String |
globalInfo()
Returns a string describing classifier
|
java.lang.String |
lambdaTipText()
Returns the tip text for this property
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
java.lang.String |
lossFunctionTipText()
Returns the tip text for this property
|
static void |
main(java.lang.String[] args)
Main method for testing this class.
|
void |
reset()
Reset the classifier.
|
void |
setDontNormalize(boolean m)
Turn normalization off/on.
|
void |
setDontReplaceMissing(boolean m)
Turn global replacement of missing values off/on.
|
void |
setEpochs(int e)
Set the number of epochs to use
|
void |
setLambda(double lambda)
Set the value of lambda to use
|
void |
setLossFunction(SelectedTag function)
Set the loss function to use.
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
java.lang.String |
toString()
Prints out the classifier.
|
void |
updateClassifier(Instance instance)
Updates the classifier with the given instance.
|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebugpublic static final Tag[] TAGS_SELECTION
public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class ClassifierCapabilitiespublic java.lang.String lambdaTipText()
public void setLambda(double lambda)
lambda - the value of lambda to usepublic double getLambda()
public java.lang.String epochsTipText()
public void setEpochs(int e)
e - the number of epochs to usepublic int getEpochs()
public void setDontNormalize(boolean m)
m - true if normalization is to be disabled.public boolean getDontNormalize()
public java.lang.String dontNormalizeTipText()
public void setDontReplaceMissing(boolean m)
m - true if global replacement of missing values is to be
turned off.public boolean getDontReplaceMissing()
public java.lang.String dontReplaceMissingTipText()
public void setLossFunction(SelectedTag function)
function - the loss function to use.public SelectedTag getLossFunction()
public java.lang.String lossFunctionTipText()
public java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class Classifierpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-L <double> The lambda regularization constant (default = 0.0001)
-E <integer> The number of epochs to perform (batch learning only, default = 500)
-N Don't normalize the data
-M Don't replace missing values
setOptions in interface OptionHandlersetOptions in class Classifieroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Classifierpublic java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic void reset()
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier in class Classifierdata - the set of training instances.java.lang.Exception - if the classifier can't be built successfully.public void updateClassifier(Instance instance) throws java.lang.Exception
updateClassifier in interface UpdateableClassifierinstance - the new training instance to include in the modeljava.lang.Exception - if the instance could not be incorporated in
the model.public double[] distributionForInstance(Instance inst) throws java.lang.Exception
distributionForInstance in class Classifierinstance - the instance for which distribution is computedjava.lang.Exception - if the distribution can't be computed successfullypublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Classifierpublic static void main(java.lang.String[] args)