@PublicationReference(author={"Shai Shalev-Shwartz","Yoram Singer","Nathan Srebro"}, title="Pegasos: Primal Estimated sub-GrAdient SOlver for SVM", year=2007, type=Conference, publication="Proceedings of the 24th International Conference on Machine Learning", url="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.74.8513") public class PrimalEstimatedSubGradient extends AbstractAnytimeSupervisedBatchLearner<Vectorizable,java.lang.Boolean,LinearBinaryCategorizer> implements Randomized
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<? extends InputOutputPair<? extends Vectorizable,java.lang.Boolean>> |
dataList
The data represented as a list.
|
protected int |
dataSampleSize
The minimum of the sample size and the data size.
|
protected int |
dataSize
The size of the data in the training set.
|
static int |
DEFAULT_MAX_ITERATIONS
The default maximum number of iterations is 10000.
|
static double |
DEFAULT_REGULARIZATION_WEIGHT
The default regularization weight is 1.0E-4.
|
static int |
DEFAULT_SAMPLE_SIZE
The default sample size is 100.
|
protected int |
dimensionality
The dimensionality of the dataset.
|
protected java.util.Random |
random
The random number generator to use.
|
protected double |
regularizationWeight
The weight assigned to the regularization term in the algorithm, which
is often represented as lambda.
|
protected LinearBinaryCategorizer |
result
The categorizer learned as a result of the algorithm.
|
protected int |
sampleSize
The sample size requested by the user.
|
protected Vector |
update
A vector used to compute the update for the weight vector.
|
data, keepGoing
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
PrimalEstimatedSubGradient()
Creates a new
PrimalEstimatedSubGradient with default parameters. |
PrimalEstimatedSubGradient(int sampleSize,
double regularizationWeight,
int maxIterations,
java.util.Random random)
Creates a new
PrimalEstimatedSubGradient with the given
parameters. |
Modifier and Type | Method and Description |
---|---|
protected void |
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has
finished.
|
java.util.Random |
getRandom()
Gets the random number generator used by this object.
|
double |
getRegularizationWeight()
Gets the regularization weight (lambda) assigned to the regularization
term of the algorithm.
|
LinearBinaryCategorizer |
getResult()
Gets the current result of the algorithm.
|
int |
getSampleSize()
Gets the sample size, which is the number of examples sampled without
replacement on each iteration of the algorithm.
|
protected boolean |
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the
data that is stored in the data field.
|
void |
setRandom(java.util.Random random)
Sets the random number generator used by this object.
|
void |
setRegularizationWeight(double regularizationWeight)
Sets the regularization weight (lambda) assigned to the regularization
term of the algorithm.
|
void |
setSampleSize(int sampleSize)
Sets the sample size, which is the number of examples sampled without
replacement on each iteration of the algorithm.
|
protected boolean |
step()
Called to take a single step of the learning algorithm.
|
clone, getData, getKeepGoing, learn, setData, setKeepGoing, stop
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
learn
clone
getMaxIterations, setMaxIterations
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
isResultValid
public static final int DEFAULT_SAMPLE_SIZE
public static final double DEFAULT_REGULARIZATION_WEIGHT
public static final int DEFAULT_MAX_ITERATIONS
protected int sampleSize
protected double regularizationWeight
protected java.util.Random random
protected transient int dataSize
protected transient java.util.ArrayList<? extends InputOutputPair<? extends Vectorizable,java.lang.Boolean>> dataList
protected transient int dimensionality
protected transient int dataSampleSize
protected transient Vector update
protected transient LinearBinaryCategorizer result
public PrimalEstimatedSubGradient()
PrimalEstimatedSubGradient
with default parameters.public PrimalEstimatedSubGradient(int sampleSize, double regularizationWeight, int maxIterations, java.util.Random random)
PrimalEstimatedSubGradient
with the given
parameters.sampleSize
- The number of examples sampled from the dataset on each iteration.regularizationWeight
- The regularization weight (lambda). Must be positive.maxIterations
- The maximum number of iterations. Must be positive.random
- The random number generator to use.protected boolean initializeAlgorithm()
AbstractAnytimeBatchLearner
initializeAlgorithm
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends InputOutputPair<? extends Vectorizable,java.lang.Boolean>>,LinearBinaryCategorizer>
protected boolean step()
AbstractAnytimeBatchLearner
step
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends InputOutputPair<? extends Vectorizable,java.lang.Boolean>>,LinearBinaryCategorizer>
protected void cleanupAlgorithm()
AbstractAnytimeBatchLearner
cleanupAlgorithm
in class AbstractAnytimeBatchLearner<java.util.Collection<? extends InputOutputPair<? extends Vectorizable,java.lang.Boolean>>,LinearBinaryCategorizer>
public LinearBinaryCategorizer getResult()
AnytimeAlgorithm
getResult
in interface AnytimeAlgorithm<LinearBinaryCategorizer>
public int getSampleSize()
public void setSampleSize(int sampleSize)
sampleSize
- The sample size. Must be positive.public double getRegularizationWeight()
public void setRegularizationWeight(double regularizationWeight)
regularizationWeight
- The regularization weight. Must be positive.public java.util.Random getRandom()
Randomized
getRandom
in interface Randomized
public void setRandom(java.util.Random random)
Randomized
setRandom
in interface Randomized
random
- The random number generator for this object to use.