public class SPegasos extends AbstractClassifier
@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} }
Modifier and Type | Field and Description |
---|---|
protected static int |
HINGE |
FloatOption |
lambdaRegularizationOption |
protected static int |
LOGLOSS |
MultiChoiceOption |
lossFunctionOption |
protected double |
m_lambda
The regularization parameter
|
protected int |
m_loss
The current loss function to minimize
|
protected double |
m_t
Holds the current iteration number
|
protected double[] |
m_weights
Stores the weights (+ bias in the last element)
|
classifierRandom, modelContext, randomSeed, randomSeedOption, trainingWeightSeenByModel
classOptionNamesToPreparedObjects, options
Constructor and Description |
---|
SPegasos() |
Modifier and Type | Method and Description |
---|---|
protected double |
dloss(double z) |
protected static double |
dotProd(weka.core.Instance inst1,
double[] weights,
int classIndex) |
double |
getLambda()
Get the current value of lambda
|
int |
getLossFunction()
Get the current loss function.
|
void |
getModelDescription(StringBuilder result,
int indent)
Returns a string representation of the model.
|
protected Measurement[] |
getModelMeasurementsImpl()
Gets the current measurements of this classifier.
The reason for ...Impl methods: ease programmer burden by not requiring them to remember calls to super in overridden methods. |
String |
getPurposeString()
Gets the purpose of this object
|
double[] |
getVotesForInstance(weka.core.Instance inst)
Calculates the class membership probabilities for the given test
instance.
|
boolean |
isRandomizable()
Gets whether this classifier needs a random seed.
|
void |
reset()
Reset the classifier.
|
void |
resetLearningImpl()
Resets this classifier.
|
void |
setLambda(double lambda)
Set the value of lambda to use
|
void |
setLossFunction(int function)
Set the loss function to use.
|
String |
toString()
Prints out the classifier.
|
void |
trainOnInstanceImpl(weka.core.Instance instance)
Trains the classifier with the given instance.
|
contextIsCompatible, copy, correctlyClassifies, getAttributeNameString, getAWTRenderer, getClassLabelString, getClassNameString, getDescription, getModelContext, getModelMeasurements, getNominalValueString, getSubClassifiers, modelAttIndexToInstanceAttIndex, modelAttIndexToInstanceAttIndex, prepareForUseImpl, resetLearning, setModelContext, setRandomSeed, trainingHasStarted, trainingWeightSeenByModel, trainOnInstance
discoverOptionsViaReflection, getCLICreationString, getOptions, getPreparedClassOption, getPreparedClassOption, prepareClassOptions, prepareForUse, prepareForUse
copy, measureByteSize, measureByteSize
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCLICreationString, getOptions, prepareForUse, prepareForUse
measureByteSize
protected double m_lambda
public FloatOption lambdaRegularizationOption
protected static final int HINGE
protected static final int LOGLOSS
protected int m_loss
public MultiChoiceOption lossFunctionOption
protected double[] m_weights
protected double m_t
public String getPurposeString()
OptionHandler
getPurposeString
in interface OptionHandler
getPurposeString
in class AbstractClassifier
public void setLambda(double lambda)
lambda
- the value of lambda to usepublic double getLambda()
public void setLossFunction(int function)
function
- the loss function to use.public int getLossFunction()
public void reset()
protected static double dotProd(weka.core.Instance inst1, double[] weights, int classIndex)
protected double dloss(double z)
public void resetLearningImpl()
AbstractClassifier
resetLearningImpl
in class AbstractClassifier
public void trainOnInstanceImpl(weka.core.Instance instance)
trainOnInstanceImpl
in class AbstractClassifier
instance
- the new training instance to include in the modelpublic double[] getVotesForInstance(weka.core.Instance inst)
instance
- the instance to be classifiedpublic void getModelDescription(StringBuilder result, int indent)
AbstractClassifier
getModelDescription
in class AbstractClassifier
result
- the stringbuilder to add the descriptionindent
- the number of characters to indentpublic String toString()
toString
in class AbstractMOAObject
protected Measurement[] getModelMeasurementsImpl()
AbstractClassifier
getModelMeasurementsImpl
in class AbstractClassifier
public boolean isRandomizable()
Classifier
Copyright © 2014 University of Waikato, Hamilton, NZ. All Rights Reserved.