public class PegasosLearningAlgorithm extends Object implements LinearMethod, ClassificationLearningAlgorithm, BinaryLearningAlgorithm
[SingerICML2007] Y. Singer and N. Srebro. Pegasos: Primal estimated sub-gradient solver for SVM. In Proceeding of ICML 2007.
Constructor and Description |
---|
PegasosLearningAlgorithm() |
PegasosLearningAlgorithm(int k,
float lambda,
int T,
String Representation,
Label label) |
Modifier and Type | Method and Description |
---|---|
PegasosLearningAlgorithm |
duplicate()
Creates a new instance of the LearningAlgorithm initialized with the same parameters
of the learningAlgorithm to be duplicated.
|
int |
getIterations()
Returns the number of iterations
|
int |
getK()
Returns the number of examples k that Pegasos exploits in its
mini-batch learning approach
|
Label |
getLabel() |
List<Label> |
getLabels()
Returns the labels representing the concept to be learned.
|
float |
getLambda()
Returns the regularization coefficient
|
BinaryLinearClassifier |
getPredictionFunction()
Returns the classifier learned during the training process
|
String |
getRepresentation()
Returns the representation this learning algorithm exploits
|
void |
learn(Dataset dataset)
It starts the training process exploiting the provided
dataset |
void |
reset()
Resets all the learning process, returning to the default state.
|
void |
setIterations(int T)
Sets the number of iterations
|
void |
setK(int k)
Sets the number of examples k that Pegasos exploits in its
mini-batch learning approach
|
void |
setLabel(Label label) |
void |
setLabels(List<Label> labels)
Sets the labels representing the concept to be learned.
|
void |
setLambda(float lambda)
Sets the regularization coefficient
|
void |
setRepresentation(String representation)
Sets the representation this learning algorithm will exploit
|
public int getK()
public void setK(int k)
k
- the k to setpublic int getIterations()
public void setIterations(int T)
T
- the number of iterations to setpublic float getLambda()
public void setLambda(float lambda)
lambda
- the lambda to setpublic String getRepresentation()
LinearMethod
getRepresentation
in interface LinearMethod
public void setRepresentation(String representation)
LinearMethod
setRepresentation
in interface LinearMethod
representation
- the representation to setpublic void learn(Dataset dataset)
LearningAlgorithm
dataset
learn
in interface LearningAlgorithm
dataset
- the training datapublic PegasosLearningAlgorithm duplicate()
LearningAlgorithm
duplicate
in interface LearningAlgorithm
public void reset()
LearningAlgorithm
reset
in interface LearningAlgorithm
public BinaryLinearClassifier getPredictionFunction()
ClassificationLearningAlgorithm
getPredictionFunction
in interface ClassificationLearningAlgorithm
getPredictionFunction
in interface LearningAlgorithm
public void setLabels(List<Label> labels)
LearningAlgorithm
setLabels
in interface BinaryLearningAlgorithm
setLabels
in interface LearningAlgorithm
labels
- the labels representing the concept to be learnedpublic List<Label> getLabels()
LearningAlgorithm
getLabels
in interface BinaryLearningAlgorithm
getLabels
in interface LearningAlgorithm
public Label getLabel()
getLabel
in interface BinaryLearningAlgorithm
public void setLabel(Label label)
setLabel
in interface BinaryLearningAlgorithm
Copyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.