public class Pegasos extends Object implements StochasticGradientOptimiser
This gradient optimiser rewrites all the Tensor
s in the Parameters
with ShrinkingTensor
. This means it keeps a different value in the Tensor
to the one produced when you call get(), so it can correctly apply regularisation to the parameters.
When finalise()
is called it rewrites the Parameters
with standard dense Tensor
s.
Follows the implementation in Factorie.
Pegasos is remarkably touchy about it's learning rates. The defaults work on a couple of examples, but it requires tuning to work properly on a specific dataset.
See:
Shalev-Shwartz S, Singer Y, Srebro N, Cotter A "Pegasos: Primal Estimated Sub-Gradient Solver for SVM" Mathematical Programming, 2011.
Constructor and Description |
---|
Pegasos(double baseRate,
double lambda) |
Modifier and Type | Method and Description |
---|---|
Pegasos |
copy()
Copies a gradient optimiser with it's configuration.
|
void |
finalise()
Finalises the gradient optimisation, setting the parameters to their correct values.
|
com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance |
getProvenance() |
void |
initialise(Parameters parameters)
Initialises the gradient optimiser.
|
void |
reset()
Resets the optimiser so it's ready to optimise a new
Parameters . |
Tensor[] |
step(Tensor[] updates,
double weight)
Take a
Tensor array of gradients and transform them
according to the current weight and learning rates. |
String |
toString() |
public void initialise(Parameters parameters)
StochasticGradientOptimiser
Configures any learning rate parameters.
initialise
in interface StochasticGradientOptimiser
parameters
- The parameters to optimise.public Tensor[] step(Tensor[] updates, double weight)
StochasticGradientOptimiser
Tensor
array of gradients and transform them
according to the current weight and learning rates.
Can return the same Tensor
array or a new one.
step
in interface StochasticGradientOptimiser
updates
- An array of gradients.weight
- The weight for the current gradients.Tensor
array of gradients.public void finalise()
StochasticGradientOptimiser
ParameterAveraging
amongst others.finalise
in interface StochasticGradientOptimiser
public void reset()
StochasticGradientOptimiser
Parameters
.reset
in interface StochasticGradientOptimiser
public Pegasos copy()
StochasticGradientOptimiser
copy
in interface StochasticGradientOptimiser
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()
getProvenance
in interface com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.