org.encog.neural.freeform
public class FreeformNetwork extends BasicML implements MLContext, Cloneable, MLRegression, MLEncodable, MLResettable, MLClassification, MLError
Constructor and Description |
---|
FreeformNetwork()
Default constructor.
|
FreeformNetwork(BasicNetwork network)
Craete a freeform network from a basic network.
|
Modifier and Type | Method and Description |
---|---|
double |
calculateError(MLDataSet data)
Calculate the error of the ML method, given a dataset.
|
int |
classify(MLData input)
Classify the input into a group.
|
void |
clearContext()
Clear the context.
|
Object |
clone()
Return a clone of this neural network.
|
MLData |
compute(MLData input)
Compute regression.
|
void |
connectLayers(FreeformLayer source,
FreeformLayer target)
Connect two layers.
|
void |
ConnectLayers(FreeformLayer source,
FreeformLayer target,
ActivationFunction theActivationFunction)
Connect two layers, assume bias activation of 1.0 and non-recurrent
connection.
|
void |
connectLayers(FreeformLayer source,
FreeformLayer target,
ActivationFunction theActivationFunction,
double biasActivation,
boolean isRecurrent)
Connect two layers.
|
FreeformLayer |
createContext(FreeformLayer source,
FreeformLayer target)
Create a context connection, such as those used by Jordan/Elmann.
|
static FreeformNetwork |
createElman(int input,
int hidden1,
int output,
ActivationFunction af)
Construct an Elmann recurrent neural network.
|
static FreeformNetwork |
createFeedforward(int input,
int hidden1,
int hidden2,
int output,
ActivationFunction af)
Create a feedforward freeform neural network.
|
FreeformLayer |
createInputLayer(int neuronCount)
Create the input layer.
|
FreeformLayer |
createLayer(int neuronCount)
Create a hidden layer.
|
FreeformLayer |
createOutputLayer(int neuronCount)
Create the output layer.
|
void |
decodeFromArray(double[] encoded)
Decode an array to this object.
|
int |
encodedArrayLength() |
void |
encodeToArray(double[] encoded)
Encode the object to the specified array.
|
int |
getInputCount() |
int |
getOutputCount() |
FreeformLayer |
getOutputLayer() |
void |
performConnectionTask(ConnectionTask task)
Perform the specified connection task.
|
void |
performNeuronTask(NeuronTask task)
Perform the specified neuron task.
|
void |
reset()
Reset the weights.
|
void |
reset(int seed)
Reset the weights with a seed.
|
void |
tempTrainingAllocate(int neuronSize,
int connectionSize)
Allocate temp training space.
|
void |
tempTrainingClear()
Clear the temp training data.
|
void |
updateContext()
Update context.
|
void |
updateProperties()
Update any objeccts when a property changes.
|
getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty
public FreeformNetwork()
public FreeformNetwork(BasicNetwork network)
network
- The basic network to use.public static FreeformNetwork createElman(int input, int hidden1, int output, ActivationFunction af)
input
- The input count.hidden1
- The hidden count.output
- The output count.af
- The activation function.public static FreeformNetwork createFeedforward(int input, int hidden1, int hidden2, int output, ActivationFunction af)
input
- The input count.hidden1
- The first hidden layer count, zero if none.hidden2
- The second hidden layer count, zero if none.output
- The output count.af
- The activation function.public double calculateError(MLDataSet data)
calculateError
in interface MLError
data
- The dataset.public int classify(MLData input)
classify
in interface MLClassification
input
- The input data to classify.public void clearContext()
clearContext
in interface MLContext
public Object clone()
public MLData compute(MLData input)
compute
in interface MLRegression
input
- The input data.public void connectLayers(FreeformLayer source, FreeformLayer target)
source
- The source layer.target
- The target layer.public void connectLayers(FreeformLayer source, FreeformLayer target, ActivationFunction theActivationFunction, double biasActivation, boolean isRecurrent)
source
- The source layer.target
- The target layer.theActivationFunction
- The activation function to use.biasActivation
- The bias activation to use.isRecurrent
- True, if this is a recurrent connection.public void ConnectLayers(FreeformLayer source, FreeformLayer target, ActivationFunction theActivationFunction)
source
- The source layer.target
- The target layer.theActivationFunction
- The activation function.public FreeformLayer createContext(FreeformLayer source, FreeformLayer target)
source
- The source layer.target
- The target layer.public FreeformLayer createInputLayer(int neuronCount)
neuronCount
- The input neuron count.public FreeformLayer createLayer(int neuronCount)
neuronCount
- The neuron count.public FreeformLayer createOutputLayer(int neuronCount)
neuronCount
- The neuron count.public void decodeFromArray(double[] encoded)
decodeFromArray
in interface MLEncodable
encoded
- The encoded array.public int encodedArrayLength()
encodedArrayLength
in interface MLEncodable
public void encodeToArray(double[] encoded)
encodeToArray
in interface MLEncodable
encoded
- The array.public int getInputCount()
getInputCount
in interface MLInput
public int getOutputCount()
getOutputCount
in interface MLOutput
public FreeformLayer getOutputLayer()
public void performConnectionTask(ConnectionTask task)
task
- The connection task.public void performNeuronTask(NeuronTask task)
task
- public void reset()
reset
in interface MLResettable
public void reset(int seed)
reset
in interface MLResettable
seed
- The seed value.public void tempTrainingAllocate(int neuronSize, int connectionSize)
neuronSize
- The number of elements to allocate on each neuron.connectionSize
- The number of elements to allocate on each connection.public void tempTrainingClear()
public void updateContext()
public void updateProperties()
updateProperties
in interface MLProperties
updateProperties
in class BasicML
Copyright © 2014. All Rights Reserved.