All Packages Class Hierarchy This Package Previous Next Index
Class sim.errFun.ErrFun
java.lang.Object
|
+----sim.errFun.ErrFun
- public abstract class ErrFun
- extends Object
- implements Parsable, Watchable
An ErrFun represents an error function to be minimized,
such as mean squared output error for a neural net, or
mean squared Bellman residual for a reinforcement-learning system,
or mean squared interference for localizing.
It is a function f(x) that maps vectors to scalars.
At a minimum, the evaluate() method should return something.
The getGradient() and getHessian() methods may or may not do
anything useful, though they may be needed if gradient descent is to
be performed on this function. The evaluate() method should always
be called before calling getGradient() or getHessian();
The get*() functions return MatrixD objects for the inputs and outputs.
These vectors can be read and set to access the current input/output values.
By default, this object contains variables and code for dealing with one
function approximator, though these can be ignored or overridden if there
are zero or two or more function approximators involved.
This code is (c) 1996 Leemon Baird
<leemon@cs.cmu.edu>,
http://www.cs.cmu.edu/~baird
The source and object code may be redistributed freely.
If the code is modified, please state so in the comments.
- Version:
- 1.3, 21 July 97
- Author:
- Leemon Baird
-
dEdIn
- gradient of mean squared error wrt inputs
-
dEdIndIn
- Second derivative of error wrt input to network wrt input to network
-
dEdOut
- The correct output that the function approximator learns to give
-
dEdOutdOut
- Second derivative of error wrt output to network wrt output to network
-
dEdWeights
- gradient of mean squared error wrt weights
-
dEdWeightsdWeights
- Second derivative of error wrt weights wrt weights to network
-
dEdWeightsSum
- gradient of mean squared error summed for all training examples
-
function
- the function approximator whose weights will be trained
-
hessian
- hessian of mean squared error wrt weights
-
inputs
- The input vector to the function approximator
-
outputs
- The output vector from the function approximator
-
watchManager
- this experiment and all the objects it contains register vars with watchManager
-
weights
- all the weights in the function approximator as a column vector
-
wmName
- the prefix string for the name of every watched variable (passed in to setWatchManager)
-
ErrFun()
-
-
BNF(int)
-
-
evaluate(Random, boolean, boolean, boolean)
- return the scalar output for the current fInput vector.
-
findGradient()
- update the fGradient vector based on the current fInput vector
-
findHessian()
- update the fHessian vector based on the current fInput vector
-
getGradient()
- The gradient of f(x) with respect to x (a column vector)
-
getHessian()
- The hessian of f(x) with respect to x (a square matrix)
-
getInput()
- The input x sent to the function f(x) (a column vector)
-
getName()
- Return the variable "name" that was passed into setWatchManager
-
getParameters(int)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
-
getWatchManager()
- Return the WatchManager set by setWatchManager().
-
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().
function
protected FunApp function
- the function approximator whose weights will be trained
inputs
protected MatrixD inputs
- The input vector to the function approximator
outputs
protected MatrixD outputs
- The output vector from the function approximator
dEdIn
protected MatrixD dEdIn
- gradient of mean squared error wrt inputs
dEdOut
protected MatrixD dEdOut
- The correct output that the function approximator learns to give
dEdIndIn
protected MatrixD dEdIndIn
- Second derivative of error wrt input to network wrt input to network
dEdOutdOut
protected MatrixD dEdOutdOut
- Second derivative of error wrt output to network wrt output to network
dEdWeightsdWeights
protected MatrixD dEdWeightsdWeights
- Second derivative of error wrt weights wrt weights to network
weights
protected MatrixD weights
- all the weights in the function approximator as a column vector
dEdWeights
protected MatrixD dEdWeights
- gradient of mean squared error wrt weights
dEdWeightsSum
protected MatrixD dEdWeightsSum
- gradient of mean squared error summed for all training examples
hessian
protected MatrixD hessian
- hessian of mean squared error wrt weights
watchManager
protected WatchManager watchManager
- this experiment and all the objects it contains register vars with watchManager
wmName
protected String wmName
- the prefix string for the name of every watched variable (passed in to setWatchManager)
ErrFun
public ErrFun()
getName
public String getName()
- Return the variable "name" that was passed into setWatchManager
getWatchManager
public WatchManager getWatchManager()
- Return the WatchManager set by setWatchManager().
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 within the ErrFun.
getParameters
public Object[][] getParameters(int lang)
- Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
- See Also:
- getParameters
BNF
public abstract String BNF(int lang)
unparse
public abstract void unparse(Unparser u,
int lang)
- Output a description of this object that can be parsed with parse().
- See Also:
- Parsable
parse
public abstract 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
getInput
public MatrixD getInput()
- The input x sent to the function f(x) (a column vector)
getGradient
public MatrixD getGradient()
- The gradient of f(x) with respect to x (a column vector)
getHessian
public MatrixD getHessian()
- The hessian of f(x) with respect to x (a square matrix)
findHessian
public void findHessian()
- update the fHessian vector based on the current fInput vector
evaluate
public abstract double evaluate(Random rnd,
boolean willFindDeriv,
boolean willFindHessian,
boolean rememberNoise)
- return the scalar output for the current fInput vector.
findGradient
public abstract void findGradient()
- update the fGradient vector based on the current fInput vector
initialize
public void initialize(int level)
- Initialize, either partially or completely.
- See Also:
- initialize
All Packages Class Hierarchy This Package Previous Next Index