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

Variable Index

 o dEdIn
gradient of mean squared error wrt inputs
 o dEdIndIn
Second derivative of error wrt input to network wrt input to network
 o dEdOut
The correct output that the function approximator learns to give
 o dEdOutdOut
Second derivative of error wrt output to network wrt output to network
 o dEdWeights
gradient of mean squared error wrt weights
 o dEdWeightsdWeights
Second derivative of error wrt weights wrt weights to network
 o dEdWeightsSum
gradient of mean squared error summed for all training examples
 o function
the function approximator whose weights will be trained
 o hessian
hessian of mean squared error wrt weights
 o inputs
The input vector to the function approximator
 o outputs
The output vector from the function approximator
 o watchManager
this experiment and all the objects it contains register vars with watchManager
 o weights
all the weights in the function approximator as a column vector
 o wmName
the prefix string for the name of every watched variable (passed in to setWatchManager)

Constructor Index

 o ErrFun()

Method Index

 o BNF(int)
 o evaluate(Random, boolean, boolean, boolean)
return the scalar output for the current fInput vector.
 o findGradient()
update the fGradient vector based on the current fInput vector
 o findHessian()
update the fHessian vector based on the current fInput vector
 o getGradient()
The gradient of f(x) with respect to x (a column vector)
 o getHessian()
The hessian of f(x) with respect to x (a square matrix)
 o getInput()
The input x sent to the function f(x) (a column vector)
 o getName()
Return the variable "name" that was passed into setWatchManager
 o getParameters(int)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.
 o getWatchManager()
Return the WatchManager set by setWatchManager().
 o initialize(int)
Initialize, either partially or completely.
 o parse(Parser, int)
Parse the input file to get the parameters for this object.
 o setWatchManager(WatchManager, String)
Register all variables with this WatchManager.
 o unparse(Unparser, int)
Output a description of this object that can be parsed with parse().

Variables

 o function
 protected FunApp function
the function approximator whose weights will be trained

 o inputs
 protected MatrixD inputs
The input vector to the function approximator

 o outputs
 protected MatrixD outputs
The output vector from the function approximator

 o dEdIn
 protected MatrixD dEdIn
gradient of mean squared error wrt inputs

 o dEdOut
 protected MatrixD dEdOut
The correct output that the function approximator learns to give

 o dEdIndIn
 protected MatrixD dEdIndIn
Second derivative of error wrt input to network wrt input to network

 o dEdOutdOut
 protected MatrixD dEdOutdOut
Second derivative of error wrt output to network wrt output to network

 o dEdWeightsdWeights
 protected MatrixD dEdWeightsdWeights
Second derivative of error wrt weights wrt weights to network

 o weights
 protected MatrixD weights
all the weights in the function approximator as a column vector

 o dEdWeights
 protected MatrixD dEdWeights
gradient of mean squared error wrt weights

 o dEdWeightsSum
 protected MatrixD dEdWeightsSum
gradient of mean squared error summed for all training examples

 o hessian
 protected MatrixD hessian
hessian of mean squared error wrt weights

 o watchManager
 protected WatchManager watchManager
this experiment and all the objects it contains register vars with watchManager

 o wmName
 protected String wmName
the prefix string for the name of every watched variable (passed in to setWatchManager)

Constructors

 o ErrFun
 public ErrFun()

Methods

 o getName
 public String getName()
Return the variable "name" that was passed into setWatchManager

 o getWatchManager
 public WatchManager getWatchManager()
Return the WatchManager set by setWatchManager().

 o 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.

 o getParameters
 public Object[][] getParameters(int lang)
Return a parameter array if BNF(), parse(), and unparse() are to be automated, null otherwise.

See Also:
getParameters
 o BNF
 public abstract String BNF(int lang)
 o unparse
 public abstract void unparse(Unparser u,
                              int lang)
Output a description of this object that can be parsed with parse().

See Also:
Parsable
 o 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
 o getInput
 public MatrixD getInput()
The input x sent to the function f(x) (a column vector)

 o getGradient
 public MatrixD getGradient()
The gradient of f(x) with respect to x (a column vector)

 o getHessian
 public MatrixD getHessian()
The hessian of f(x) with respect to x (a square matrix)

 o findHessian
 public void findHessian()
update the fHessian vector based on the current fInput vector

 o evaluate
 public abstract double evaluate(Random rnd,
                                 boolean willFindDeriv,
                                 boolean willFindHessian,
                                 boolean rememberNoise)
return the scalar output for the current fInput vector.

 o findGradient
 public abstract void findGradient()
update the fGradient vector based on the current fInput vector

 o initialize
 public void initialize(int level)
Initialize, either partially or completely.

See Also:
initialize

All Packages  Class Hierarchy  This Package  Previous  Next  Index