org.encog.mathutil.matrices.hessian

## Class HessianFD

• All Implemented Interfaces:
ComputeHessian

```public class HessianFD
extends BasicHessian```
Calculate the Hessian matrix using the finite difference method. This is a very simple method of calculating the Hessian. The algorithm does not vary greatly by number layers. This makes it very useful as a tool to check the accuracy of other methods of determining the Hessian. For more information on the Finite Difference Method see the following article. http://en.wikipedia.org/wiki/Finite_difference_method
• ### Field Summary

Fields
Modifier and Type Field and Description
`double` `INITIAL_STEP`
The initial step size for dStep.
• ### Fields inherited from class org.encog.mathutil.matrices.hessian.BasicHessian

`flat, gradients, hessian, hessianMatrix, network, sse, training`
• ### Constructor Summary

Constructors
Constructor and Description
`HessianFD()`
• ### Method Summary

Methods
Modifier and Type Method and Description
`void` `compute()`
Compute the Hessian.
`double[]` `createCoefficients()`
Compute finite difference coefficients according to the method provided here: http://en.wikipedia.org/wiki/Finite_difference_coefficients
`int` `getPointsPerSide()`
`void` ```init(BasicNetwork theNetwork, MLDataSet theTraining)```
Init the class.
`void` `setPointsPerSide(int pointsPerSide)`
This specifies the number of points per side, default is 5.
• ### Methods inherited from class org.encog.mathutil.matrices.hessian.BasicHessian

`clear, getGradients, getHessian, getHessianMatrix, getSSE, updateHessian`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Field Detail

• #### INITIAL_STEP

`public final double INITIAL_STEP`
The initial step size for dStep.
Constant Field Values
• ### Constructor Detail

• #### HessianFD

`public HessianFD()`
• ### Method Detail

• #### init

```public void init(BasicNetwork theNetwork,
MLDataSet theTraining)```
Init the class.
Specified by:
`init` in interface `ComputeHessian`
Overrides:
`init` in class `BasicHessian`
Parameters:
`theNetwork` - The neural network to train.
`theTraining` - The training set to train with.
• #### compute

`public void compute()`
Compute the Hessian.
• #### createCoefficients

`public double[] createCoefficients()`
Compute finite difference coefficients according to the method provided here: http://en.wikipedia.org/wiki/Finite_difference_coefficients
Returns:
An array of the coefficients for FD.
• #### getPointsPerSide

`public int getPointsPerSide()`
Returns:
The number of points per side.
• #### setPointsPerSide

`public void setPointsPerSide(int pointsPerSide)`
This specifies the number of points per side, default is 5. Must be called before init.
Parameters:
`pointsPerSide` - The number of points per side.