|
||||||||||
| 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 final double calculateError(MLDataSet data)
data - The training set.
public final void clearConnectionLimit()
public final void clearContext()
public FlatNetwork clone()
clone in class Objectpublic final 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 final double[] encodeNetwork()
public final ActivationFunction[] getActivationFunctions()
public final int getBeginTraining()
public final double[] getBiasActivation()
public final double getConnectionLimit()
public final int[] getContextTargetOffset()
public final int[] getContextTargetSize()
public final int getEncodeLength()
public final int getEndTraining()
public final boolean getHasContext()
public final int getInputCount()
public final int[] getLayerContextCount()
public final int[] getLayerCounts()
public final int[] getLayerFeedCounts()
public final int[] getLayerIndex()
public final double[] getLayerOutput()
public final int getNeuronCount()
public final int getOutputCount()
public final int[] getWeightIndex()
public final double[] getWeights()
public final Class<?> hasSameActivationFunction()
public final void init(FlatLayer[] layers)
layers - The layers of the network to create.public final boolean isLimited()
public final void randomize()
public final void randomize(double hi,
double lo)
hi - The network high.lo - The network low.public final void setActivationFunctions(ActivationFunction[] af)
af - The activation functions.public final void setBeginTraining(int beginTraining)
beginTraining - the beginTraining to setpublic final void setBiasActivation(double[] biasActivation)
biasActivation - The bias activation.public final void setConnectionLimit(double connectionLimit)
connectionLimit - the connectionLimit to setpublic final void setContextTargetOffset(int[] contextTargetOffset)
contextTargetOffset - The context target offset.public final void setContextTargetSize(int[] contextTargetSize)
contextTargetSize - The context target size.public void setEndTraining(int endTraining)
endTraining - the endTraining to setpublic final void setHasContext(boolean hasContext)
hasContext - True if the network has context.public final void setInputCount(int inputCount)
inputCount - The input count.public final void setLayerContextCount(int[] layerContextCount)
layerContextCount - The layer context count.public final void setLayerCounts(int[] layerCounts)
layerCounts - The layer counts.public final void setLayerFeedCounts(int[] layerFeedCounts)
public final void setLayerIndex(int[] i)
i - The layer index.public final void setLayerOutput(double[] layerOutput)
layerOutput - The layer output.public final void setOutputCount(int outputCount)
outputCount - The output count.public final void setWeightIndex(int[] weightIndex)
weightIndex - The weight index.public final 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 | |||||||||