org.encog.neural.thermal
Class HopfieldNetwork
- java.lang.Object
-
- org.encog.ml.BasicML
-
- org.encog.neural.thermal.ThermalNetwork
-
- org.encog.neural.thermal.HopfieldNetwork
-
- All Implemented Interfaces:
- java.io.Serializable, MLAutoAssocation, MLInput, MLInputOutput, MLMethod, MLOutput, MLProperties, MLRegression, MLResettable
public class HopfieldNetwork extends ThermalNetwork
Implements a Hopfield network.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description HopfieldNetwork()Default constructor.HopfieldNetwork(int neuronCount)Construct a Hopfield with the specified neuron count.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddPattern(MLData pattern)Train the neural network for the specified pattern.MLDatacompute(MLData input)Note: for Hopfield networks, you will usually want to call the "run" method to compute the output.intgetInputCount()intgetOutputCount()voidrun()Perform one Hopfield iteration.intrunUntilStable(int max)Run the network until it becomes stable and does not change from more runs.voidupdateProperties()Update any objeccts when a property changes.-
Methods inherited from class org.encog.neural.thermal.ThermalNetwork
addWeight, calculateEnergy, clear, getCurrentState, getNeuronCount, getWeight, getWeights, init, reset, reset, setCurrentState, setCurrentState, setNeuronCount, setWeight, setWeights
-
Methods inherited from class org.encog.ml.BasicML
getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty
-
-
-
-
Constructor Detail
-
HopfieldNetwork
public HopfieldNetwork()
Default constructor.
-
HopfieldNetwork
public HopfieldNetwork(int neuronCount)
Construct a Hopfield with the specified neuron count.- Parameters:
neuronCount- The neuron count.
-
-
Method Detail
-
addPattern
public void addPattern(MLData pattern)
Train the neural network for the specified pattern. The neural network can be trained for more than one pattern. To do this simply call the train method more than once.- Parameters:
pattern- The pattern to train for.
-
compute
public MLData compute(MLData input)
Note: for Hopfield networks, you will usually want to call the "run" method to compute the output. This method can be used to copy the input data to the current state. A single iteration is then run, and the new current state is returned.- Parameters:
input- The input pattern.- Returns:
- The new current state.
-
getInputCount
public int getInputCount()
- Returns:
- The input.
-
getOutputCount
public int getOutputCount()
- Returns:
- The output count.
-
run
public void run()
Perform one Hopfield iteration.
-
runUntilStable
public int runUntilStable(int max)
Run the network until it becomes stable and does not change from more runs.- Parameters:
max- The maximum number of cycles to run before giving up.- Returns:
- The number of cycles that were run.
-
updateProperties
public void updateProperties()
Update any objeccts when a property changes.- Specified by:
updatePropertiesin interfaceMLProperties- Specified by:
updatePropertiesin classBasicML
-
-
DMelt 3.0 © DataMelt by jWork.ORG