All Packages Class Hierarchy This Package Previous Next Index
Class sim.errFun.Batch
java.lang.Object
|
+----sim.errFun.ErrFun
|
+----sim.errFun.Batch
- public class Batch
- extends ErrFun
Combine N calls to an error function into a single error number. This allows
something like epoch-wise batch learning on infinite training sets.
This code is (c) 1997 Leemon Baird
<harmonme@aa.wpafb.af.mil>,
http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely provided
no fee is charged. If the code is modified, please state so
in the comments.
- Version:
- 1.02, 23 July 97
- Author:
- Leemon Baird
-
batchIndex
- which of the batch elements is currently being processed.
-
batchSize
- the number of times to call the error function
-
errFun
- the error function to query multiple times
-
errFunGradient
- the gradient from a single call to errFun
-
gradient
- the average of the gradients from all batchSize calls to errFun
-
Batch()
-
-
BNF(int)
- Return the BNF description of how to parse the parameters of this object.
-
evaluate(Random, boolean, boolean, boolean)
- return the scalar output for the current dInput vector
-
findGradient()
- update the gradient vector based on the current fInput vector.
-
getGradient()
- The gradient of f(x) with respect to x (a column vector)
-
getInput()
- The input x sent to the function f(x) (a column vector)
-
initialize(int)
- Initialize, either partially or completely.
-
parse(Parser, int)
- Parse the input file to get the parameters for this object.
-
setWatchManager(WatchManager, String)
- Register all variables with this WatchManager.
-
unparse(Unparser, int)
- Output a description of this object that can be parsed with parse().
errFun
protected ErrFun errFun
- the error function to query multiple times
batchSize
protected IntExp batchSize
- the number of times to call the error function
errFunGradient
protected MatrixD errFunGradient
- the gradient from a single call to errFun
gradient
protected MatrixD gradient
- the average of the gradients from all batchSize calls to errFun
batchIndex
protected PInt batchIndex
- which of the batch elements is currently being processed. Counts
repeatedly from 0 to N-1 than back to 0 for batches of N elements.
Batch
public Batch()
setWatchManager
public void setWatchManager(WatchManager wm,
String name)
- Register all variables with this WatchManager.
This will be called after all parsing is done.
setWatchManager should be overridden and forced to
call the same method on all the other objects in the experiment.
- Overrides:
- setWatchManager in class ErrFun
BNF
public String BNF(int lang)
- Return the BNF description of how to parse the parameters of this object.
- Overrides:
- BNF in class ErrFun
unparse
public void unparse(Unparser u,
int lang)
- Output a description of this object that can be parsed with parse().
- Overrides:
- unparse in class ErrFun
- See Also:
- Parsable
parse
public Object parse(Parser p,
int lang) throws ParserException
- Parse the input file to get the parameters for this object.
- Throws: ParserException
- parser didn't find the required token
- Overrides:
- parse in class ErrFun
evaluate
public double evaluate(Random rnd,
boolean willFindDeriv,
boolean willFindHess,
boolean rememberNoise)
- return the scalar output for the current dInput vector
- Overrides:
- evaluate in class ErrFun
findGradient
public void findGradient()
- update the gradient vector based on the current fInput vector.
Assumes that evaluate() was already called on this vector.
- Overrides:
- findGradient in class ErrFun
getGradient
public MatrixD getGradient()
- The gradient of f(x) with respect to x (a column vector)
- Overrides:
- getGradient in class ErrFun
getInput
public MatrixD getInput()
- The input x sent to the function f(x) (a column vector)
- Overrides:
- getInput in class ErrFun
initialize
public void initialize(int level)
- Initialize, either partially or completely.
- Overrides:
- initialize in class ErrFun
- See Also:
- initialize
All Packages Class Hierarchy This Package Previous Next Index