ca.nengo.math.impl
Class GradientDescentApproximator
java.lang.Object
ca.nengo.math.impl.GradientDescentApproximator
- All Implemented Interfaces:
- LinearApproximator, java.io.Serializable, java.lang.Cloneable
public class GradientDescentApproximator
- extends java.lang.Object
- implements LinearApproximator
A LinearApproximator that searches for coefficients by descending an error gradient.
This method is slower and less powerful than WeightedCostApproximator, but
constraints on coefficients are allowed.
- Author:
- Bryan Tripp
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GradientDescentApproximator
public GradientDescentApproximator(float[][] evaluationPoints,
float[][] values,
GradientDescentApproximator.Constraints constraints,
boolean ignoreBias)
- Parameters:
evaluationPoints
- Points at which error is evaluated (should be uniformly
distributed, as the sum of error at these points is treated as an integral
over the domain of interest). Examples include vector inputs to an ensemble,
or different points in time within different simulation regimes.values
- The values of whatever functions are being combined, at the
evaluationPoints. Commonly neuron firing rates. The first dimension makes up
the list of functions, and the second the values of these functions at each
evaluation point.constraints
- Constraints on coefficientsignoreBias
- If true, bias in constituent and target functions is ignored (resulting
estimate will be biased)
getEvalPoints
public float[][] getEvalPoints()
- Specified by:
getEvalPoints
in interface LinearApproximator
- Returns:
- Points at which target functions are evaluated. Each row (or float[]) corresponds to
a single evaluation point. These points should usually be uniformly distributed, because
the sum of error at these points is treated as an integral over the domain of interest.
- See Also:
LinearApproximator.getEvalPoints()
getValues
public float[][] getValues()
- Specified by:
getValues
in interface LinearApproximator
- Returns:
- The values of component functions at the evaluation points. The first dimension
makes up the list of functions, and the second the values of these functions at each
evaluation point.
- See Also:
LinearApproximator.getValues()
setStartingCoefficients
public void setStartingCoefficients(float[] coefficients)
- Parameters:
coefficients
- Coefficients at which to start the optimization
getMaxIterations
public int getMaxIterations()
- Returns:
- Maximum iterations per findCoefficients(...)
setMaxIterations
public void setMaxIterations(int max)
- Parameters:
max
- New maximum number of iterations per findCoefficients(...)
getTolerance
public float getTolerance()
- Returns:
- Target mean-squared error
setTolerance
public void setTolerance(float tolerance)
- Parameters:
tolerance
- Target mean-squared error
findCoefficients
public float[] findCoefficients(Function target)
- Description copied from interface:
LinearApproximator
- Note: more information is needed than the arguments provide (for example
the functions that are to be combined to estimate the target). These other
data are object properties. This enables re-use of calculations based on these
data, for estimating multiple functions.
- Specified by:
findCoefficients
in interface LinearApproximator
- Parameters:
target
- Function to approximate
- Returns:
- coefficients on component functions which result in an approximation of the
target
- See Also:
LinearApproximator.findCoefficients(ca.nengo.math.Function)
clone
public LinearApproximator clone()
throws java.lang.CloneNotSupportedException
- Specified by:
clone
in interface LinearApproximator
- Overrides:
clone
in class java.lang.Object
- Throws:
java.lang.CloneNotSupportedException