|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.encog.neural.flat.FlatNetwork
public class FlatNetwork
Implements a flat (vector based) neural network in the Encog Engine. This is meant to be a very highly efficient feedforward, or simple recurrent, neural network. It uses a minimum of objects and is designed with one principal in mind-- SPEED. Readability, code reuse, object oriented programming are all secondary in consideration. Vector based neural networks are also very good for GPU processing. The flat network classes will make use of the GPU if you have enabled GPU processing. See the Encog class for more info.
Field Summary | |
---|---|
static double |
DEFAULT_BIAS_ACTIVATION
The default bias activation. |
static double |
NO_BIAS_ACTIVATION
The value that indicates that there is no bias activation. |
Constructor Summary | |
---|---|
FlatNetwork()
Default constructor. |
|
FlatNetwork(FlatLayer[] layers)
Create a flat network from an array of layers. |
|
FlatNetwork(int input,
int hidden1,
int hidden2,
int output,
boolean tanh)
Construct a flat neural network. |
Method Summary | |
---|---|
double |
calculateError(MLDataSet data)
Calculate the error for this neural network. |
void |
clearConnectionLimit()
Clear any connection limits. |
void |
clearContext()
Clear any context neurons. |
FlatNetwork |
clone()
Clone the network. |
void |
cloneFlatNetwork(FlatNetwork result)
Clone into the flat network passed in. |
void |
compute(double[] input,
double[] output)
Calculate the output for the given input. |
protected void |
computeLayer(int currentLayer)
Calculate a layer. |
void |
decodeNetwork(double[] data)
Decode the specified data into the weights of the neural network. |
double[] |
encodeNetwork()
Encode the neural network to an array of doubles. |
ActivationFunction[] |
getActivationFunctions()
|
int |
getBeginTraining()
|
double[] |
getBiasActivation()
|
double |
getConnectionLimit()
|
int[] |
getContextTargetOffset()
|
int[] |
getContextTargetSize()
|
int |
getEncodeLength()
|
int |
getEndTraining()
|
boolean |
getHasContext()
|
int |
getInputCount()
|
int[] |
getLayerContextCount()
|
int[] |
getLayerCounts()
|
int[] |
getLayerFeedCounts()
|
int[] |
getLayerIndex()
|
double[] |
getLayerOutput()
|
double[] |
getLayerSums()
|
int |
getNeuronCount()
|
int |
getOutputCount()
|
int[] |
getWeightIndex()
|
double[] |
getWeights()
|
Class<?> |
hasSameActivationFunction()
Neural networks with only one type of activation function offer certain optimization options. |
void |
init(FlatLayer[] layers)
Construct a flat network. |
boolean |
isLimited()
|
void |
randomize()
Perform a simple randomization of the weights of the neural network between -1 and 1. |
void |
randomize(double hi,
double lo)
Perform a simple randomization of the weights of the neural network between the specified hi and lo. |
void |
setActivationFunctions(ActivationFunction[] af)
Set the activation functions. |
void |
setBeginTraining(int beginTraining)
|
void |
setBiasActivation(double[] biasActivation)
Set the bias activation. |
void |
setConnectionLimit(double connectionLimit)
|
void |
setContextTargetOffset(int[] contextTargetOffset)
Set the context target offset. |
void |
setContextTargetSize(int[] contextTargetSize)
Set the context target size. |
void |
setEndTraining(int endTraining)
|
void |
setHasContext(boolean hasContext)
Set the hasContext property. |
void |
setInputCount(int inputCount)
Set the input count. |
void |
setLayerContextCount(int[] layerContextCount)
Set the layer context count. |
void |
setLayerCounts(int[] layerCounts)
Set the layer counts. |
void |
setLayerFeedCounts(int[] layerFeedCounts)
|
void |
setLayerIndex(int[] i)
Set the layer index. |
void |
setLayerOutput(double[] layerOutput)
Set the layer output. |
void |
setLayerSums(double[] d)
Set the layer sums. |
void |
setOutputCount(int outputCount)
Set the output count. |
void |
setWeightIndex(int[] weightIndex)
Set the weight index. |
void |
setWeights(double[] weights)
Set the weights. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEFAULT_BIAS_ACTIVATION
public static final double NO_BIAS_ACTIVATION
Constructor Detail |
---|
public FlatNetwork()
public FlatNetwork(FlatLayer[] layers)
layers
- The layers.public FlatNetwork(int input, int hidden1, int hidden2, int output, boolean tanh)
input
- Neurons in the input layer.hidden1
- Neurons in the first hidden layer. Zero for no first hidden
layer.hidden2
- Neurons in the second hidden layer. Zero for no second hidden
layer.output
- Neurons in the output layer.tanh
- True if this is a tanh activation, false for sigmoid.Method Detail |
---|
public double calculateError(MLDataSet data)
data
- The training set.
public void clearConnectionLimit()
public void clearContext()
public FlatNetwork clone()
clone
in class Object
public void cloneFlatNetwork(FlatNetwork result)
result
- The network to copy into.public void compute(double[] input, double[] output)
input
- The input.output
- Output will be placed here.protected void computeLayer(int currentLayer)
currentLayer
- The layer to calculate.public void decodeNetwork(double[] data)
data
- The data to be decoded.public double[] encodeNetwork()
public ActivationFunction[] getActivationFunctions()
public int getBeginTraining()
public double[] getBiasActivation()
public double getConnectionLimit()
public int[] getContextTargetOffset()
public int[] getContextTargetSize()
public int getEncodeLength()
public int getEndTraining()
public boolean getHasContext()
public int getInputCount()
public int[] getLayerContextCount()
public int[] getLayerCounts()
public int[] getLayerFeedCounts()
public int[] getLayerIndex()
public double[] getLayerOutput()
public int getNeuronCount()
public int getOutputCount()
public int[] getWeightIndex()
public double[] getWeights()
public Class<?> hasSameActivationFunction()
public void init(FlatLayer[] layers)
layers
- The layers of the network to create.public boolean isLimited()
public void randomize()
public void randomize(double hi, double lo)
hi
- The network high.lo
- The network low.public void setActivationFunctions(ActivationFunction[] af)
af
- The activation functions.public void setBeginTraining(int beginTraining)
beginTraining
- the beginTraining to setpublic void setBiasActivation(double[] biasActivation)
biasActivation
- The bias activation.public void setConnectionLimit(double connectionLimit)
connectionLimit
- the connectionLimit to setpublic void setContextTargetOffset(int[] contextTargetOffset)
contextTargetOffset
- The context target offset.public void setContextTargetSize(int[] contextTargetSize)
contextTargetSize
- The context target size.public void setEndTraining(int endTraining)
endTraining
- the endTraining to setpublic void setHasContext(boolean hasContext)
hasContext
- True if the network has context.public void setInputCount(int inputCount)
inputCount
- The input count.public void setLayerContextCount(int[] layerContextCount)
layerContextCount
- The layer context count.public void setLayerCounts(int[] layerCounts)
layerCounts
- The layer counts.public void setLayerFeedCounts(int[] layerFeedCounts)
public void setLayerIndex(int[] i)
i
- The layer index.public void setLayerOutput(double[] layerOutput)
layerOutput
- The layer output.public void setOutputCount(int outputCount)
outputCount
- The output count.public void setWeightIndex(int[] weightIndex)
weightIndex
- The weight index.public void setWeights(double[] weights)
weights
- The weights.public double[] getLayerSums()
public void setLayerSums(double[] d)
d
- The layer sums.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |