Package org.tribuo.math.optimisers
Class ParameterAveraging
java.lang.Object
org.tribuo.math.optimisers.ParameterAveraging
- All Implemented Interfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,StochasticGradientOptimiser
Averages the parameters across a gradient run.
Wraps an inner gradient optimiser. Only changes the values when finalise()
is called
See:
Polyak BT, Juditsky AB "Acceleration of Stochastic Approximation by Averaging" SIAM Journal on Control and Optimization, 1992.
-
Constructor Summary
ConstructorDescriptionParameterAveraging
(StochasticGradientOptimiser optimiser) Adds parameter averaging around a gradient optimiser. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copies a gradient optimiser with it's configuration.void
finalise()
This sets the parameters to their average value.com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance
void
initialise
(Parameters parameters) Initialises the gradient optimiser.void
reset()
Resets the optimiser so it's ready to optimise a newParameters
.Tensor[]
This passes the gradient update to the inner optimiser, then updates the average weight values.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
-
Constructor Details
-
ParameterAveraging
Adds parameter averaging around a gradient optimiser.- Parameters:
optimiser
- The inner optimiser to use to scale the gradients.
-
-
Method Details
-
initialise
Description copied from interface:StochasticGradientOptimiser
Initialises the gradient optimiser.Configures any learning rate parameters.
- Specified by:
initialise
in interfaceStochasticGradientOptimiser
- Parameters:
parameters
- The parameters to optimise.
-
step
This passes the gradient update to the inner optimiser, then updates the average weight values.- Specified by:
step
in interfaceStochasticGradientOptimiser
- Parameters:
updates
- An array of gradients.weight
- The weight for the current gradients.- Returns:
- The gradients from the inner optimiser.
-
finalise
public void finalise()This sets the parameters to their average value.- Specified by:
finalise
in interfaceStochasticGradientOptimiser
-
toString
-
reset
public void reset()Description copied from interface:StochasticGradientOptimiser
Resets the optimiser so it's ready to optimise a newParameters
.- Specified by:
reset
in interfaceStochasticGradientOptimiser
-
copy
Description copied from interface:StochasticGradientOptimiser
Copies a gradient optimiser with it's configuration. Usually calls the copy constructor.- Specified by:
copy
in interfaceStochasticGradientOptimiser
- Returns:
- A gradient optimiser with the same configuration, but independent state.
-
getProvenance
public com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance getProvenance()- Specified by:
getProvenance
in interfacecom.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
-