org.encog.neural.flat
public class FlatNetwork extends Object implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public static final double DEFAULT_BIAS_ACTIVATION
public static final double NO_BIAS_ACTIVATION
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.public double calculateError(MLDataSet data)
data
- The training set.public void clearConnectionLimit()
public void clearContext()
public FlatNetwork clone()
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.Copyright © 2014. All Rights Reserved.