org.encog.neural.networks
public class BasicNetwork extends BasicML implements ContainsFlat, MLContext, MLRegression, MLEncodable, MLResettable, MLClassification, MLError, MLFactory
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_CONNECTION_LIMIT
The default connection limit.
|
static String |
TAG_BEGIN_TRAINING
The property for begin training.
|
static String |
TAG_BIAS_ACTIVATION
The property for bias activation.
|
static String |
TAG_CONNECTION_LIMIT
The property for connection limit.
|
static String |
TAG_CONTEXT_TARGET_OFFSET
The property for context target offset.
|
static String |
TAG_CONTEXT_TARGET_SIZE
The property for context target size.
|
static String |
TAG_END_TRAINING
The property for end training.
|
static String |
TAG_HAS_CONTEXT
The property for has context.
|
static String |
TAG_LAYER_CONTEXT_COUNT
The property for layer context count.
|
static String |
TAG_LAYER_COUNTS
The property for layer counts.
|
static String |
TAG_LAYER_FEED_COUNTS
The property for layer feed counts.
|
static String |
TAG_LAYER_INDEX
The property for layer index.
|
static String |
TAG_LIMIT
Tag used for the connection limit.
|
static String |
TAG_WEIGHT_INDEX
The property for weight index.
|
Constructor and Description |
---|
BasicNetwork()
Construct an empty neural network.
|
Modifier and Type | Method and Description |
---|---|
void |
addLayer(Layer layer)
Add a layer to the neural network.
|
void |
addWeight(int fromLayer,
int fromNeuron,
int toNeuron,
double value)
Add to a weight.
|
double |
calculateError(MLDataSet data)
Calculate the error for this neural network.
|
int |
calculateNeuronCount()
Calculate the total number of neurons in the network across all layers.
|
int |
classify(MLData input)
Classify the input into a group.
|
void |
clearContext()
Clear any data from any context layers.
|
Object |
clone()
Return a clone of this neural network.
|
void |
compute(double[] input,
double[] output)
Compute the output for this network.
|
MLData |
compute(MLData input)
Compute the output for a given input to the neural network.
|
void |
decodeFromArray(double[] encoded)
Decode an array to this object.
|
String |
dumpWeights() |
void |
enableConnection(int fromLayer,
int fromNeuron,
int toNeuron,
boolean enable)
Enable, or disable, a connection.
|
int |
encodedArrayLength() |
void |
encodeToArray(double[] encoded)
Encode the object to the specified array.
|
boolean |
equals(BasicNetwork other,
int precision)
Determine if this neural network is equal to another.
|
boolean |
equals(Object other)
Compare the two neural networks.
|
ActivationFunction |
getActivation(int layer)
Get the activation function for the specified layer.
|
String |
getFactoryArchitecture() |
String |
getFactoryType() |
FlatNetwork |
getFlat() |
int |
getInputCount() |
double |
getLayerBiasActivation(int l)
Get the bias activation for the specified layer.
|
int |
getLayerCount() |
int |
getLayerNeuronCount(int l)
Get the neuron count.
|
double |
getLayerOutput(int layer,
int neuronNumber)
Get the layer output for the specified neuron.
|
int |
getLayerTotalNeuronCount(int l)
Get the total (including bias and context) neuron cont for a layer.
|
int |
getOutputCount() |
NeuralStructure |
getStructure() |
double |
getWeight(int fromLayer,
int fromNeuron,
int toNeuron)
Get the weight between the two layers.
|
int |
hashCode()
Generate a hash code.
|
boolean |
isConnected(int layer,
int fromNeuron,
int toNeuron)
Determine if the specified connection is enabled.
|
boolean |
isLayerBiased(int l)
Determine if the specified layer is biased.
|
void |
reset()
Reset the weight matrix and the bias values.
|
void |
reset(int seed)
Reset the weight matrix and the bias values.
|
void |
setBiasActivation(double activation)
Sets the bias activation for every layer that supports bias.
|
void |
setLayerBiasActivation(int l,
double value)
Set the bias activation for the specified layer.
|
void |
setWeight(int fromLayer,
int fromNeuron,
int toNeuron,
double value)
Set the weight between the two specified neurons.
|
String |
toString() |
void |
updateProperties()
Update any objeccts when a property changes.
|
void |
validateNeuron(int targetLayer,
int neuron)
Validate the the specified targetLayer and neuron are valid.
|
int |
winner(MLData input)
Determine the winner for the specified input.
|
getProperties, getPropertyDouble, getPropertyLong, getPropertyString, setProperty, setProperty, setProperty
public static final String TAG_LIMIT
public static final double DEFAULT_CONNECTION_LIMIT
public static final String TAG_CONNECTION_LIMIT
public static final String TAG_BEGIN_TRAINING
public static final String TAG_CONTEXT_TARGET_OFFSET
public static final String TAG_CONTEXT_TARGET_SIZE
public static final String TAG_END_TRAINING
public static final String TAG_HAS_CONTEXT
public static final String TAG_LAYER_COUNTS
public static final String TAG_LAYER_FEED_COUNTS
public static final String TAG_LAYER_INDEX
public static final String TAG_WEIGHT_INDEX
public static final String TAG_BIAS_ACTIVATION
public static final String TAG_LAYER_CONTEXT_COUNT
public void addLayer(Layer layer)
layer
- The layer to be added to the network.public void addWeight(int fromLayer, int fromNeuron, int toNeuron, double value)
fromLayer
- The from layer.fromNeuron
- The from neuron.toNeuron
- The to neuron.value
- The value to add.public double calculateError(MLDataSet data)
calculateError
in interface MLError
data
- The training set.public int calculateNeuronCount()
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 void compute(double[] input, double[] output)
input
- The input.output
- The output.public MLData compute(MLData input)
compute
in interface MLRegression
input
- The input to the neural network.public void decodeFromArray(double[] encoded)
decodeFromArray
in interface MLEncodable
encoded
- The encoded array.public String dumpWeights()
public void enableConnection(int fromLayer, int fromNeuron, int toNeuron, boolean enable)
fromLayer
- The layer that contains the from neuron.fromNeuron
- The source neuron.toNeuron
- The target connection.enable
- True to enable, false to disable.public int encodedArrayLength()
encodedArrayLength
in interface MLEncodable
public void encodeToArray(double[] encoded)
encodeToArray
in interface MLEncodable
encoded
- The array.public boolean equals(Object other)
public boolean equals(BasicNetwork other, int precision)
other
- The other neural network.precision
- The number of decimal places to compare to.public ActivationFunction getActivation(int layer)
layer
- The layer.public FlatNetwork getFlat()
getFlat
in interface ContainsFlat
public int getInputCount()
getInputCount
in interface MLInput
public double getLayerBiasActivation(int l)
l
- The layer.public int getLayerCount()
public int getLayerNeuronCount(int l)
l
- The layer.public double getLayerOutput(int layer, int neuronNumber)
layer
- The layer.neuronNumber
- The neuron number.public int getLayerTotalNeuronCount(int l)
l
- The layer.public int getOutputCount()
getOutputCount
in interface MLOutput
public NeuralStructure getStructure()
public double getWeight(int fromLayer, int fromNeuron, int toNeuron)
fromLayer
- The from layer.fromNeuron
- The from neuron.toNeuron
- The to neuron.public int hashCode()
public boolean isConnected(int layer, int fromNeuron, int toNeuron)
layer
- The layer to check.fromNeuron
- The source neuron.toNeuron
- THe target neuron.public boolean isLayerBiased(int l)
l
- The layer number.public void reset()
reset
in interface MLResettable
public void reset(int seed)
reset
in interface MLResettable
seed
- The seed value.public void setBiasActivation(double activation)
activation
- THe new activation.public void setLayerBiasActivation(int l, double value)
l
- The layer to use.value
- The bias activation.public void setWeight(int fromLayer, int fromNeuron, int toNeuron, double value)
fromLayer
- The from layer.fromNeuron
- The from neuron.toNeuron
- The to neuron.value
- The to value.public void updateProperties()
updateProperties
in interface MLProperties
updateProperties
in class BasicML
public void validateNeuron(int targetLayer, int neuron)
targetLayer
- The target layer.neuron
- The target neuron.public int winner(MLData input)
input
- The input patter to present to the neural network.public String getFactoryType()
getFactoryType
in interface MLFactory
public String getFactoryArchitecture()
getFactoryArchitecture
in interface MLFactory
Copyright © 2014. All Rights Reserved.