|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectneural.net.Network
public class Network
Representation of an Artificial Neural Network The number of inputs, outputs, and neurons in the hidden layer are configurable and the Activation Function can be configured too with any class that implements the ActivationFunction interface. This Network is restricted to use exactly one hidden layer
Constructor Summary | |
---|---|
Network(int inputCount,
int outputCount,
int hiddenLayerNeuronCount)
Constructor - uses default ActivationFunction (Sigmoid) |
|
Network(int inputCount,
int outputCount,
int hiddenLayerNeuronCount,
ActivationFunction activationFunction)
Constructor |
Method Summary | |
---|---|
double[] |
fire(double[] inputs)
Fire each layer in the Network |
ActivationFunction |
getActivationFunction()
Get the instance of the ActivationFunction being used |
Layer |
getHiddenLayer()
Get the hidden layer |
int |
getInputCount()
Get number of inputs |
double[] |
getLastOutputs()
Get last output values |
int |
getOutputCount()
Get number of outputs |
Layer |
getOutputLayer()
Get the output layer |
static Network |
load(java.io.File file)
Load a Network from a file |
void |
save(java.io.File file)
Save the neural network to a file, this should be used after training is complete so that the Network can be reloaded and training will not need to be redone |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Network(int inputCount, int outputCount, int hiddenLayerNeuronCount, ActivationFunction activationFunction)
inputCount
- - number of inputsoutputCount
- - number of output neuronshiddenLayerNeuronCount
- - number of neurons in the hidden layeractivationFunction
- - class implementing ActivationFunction, used to calculate activation value of neuronpublic Network(int inputCount, int outputCount, int hiddenLayerNeuronCount)
inputCount
- - number of inputsoutputCount
- - number of output neuronshiddenLayerNeuronCount
- - number of neurons in the hidden layerMethod Detail |
---|
public int getInputCount()
public int getOutputCount()
public double[] getLastOutputs()
public ActivationFunction getActivationFunction()
public Layer getHiddenLayer()
public Layer getOutputLayer()
public double[] fire(double[] inputs) throws java.lang.Exception
inputs
- - inputs to be passed to the first layer
java.lang.Exception
- - throws an exception if input length is incorrectpublic void save(java.io.File file) throws java.lang.Exception
file
- - File to save
FileNotFoundException,
- IOException
java.lang.Exception
public static Network load(java.io.File file) throws java.lang.Exception
file
- - File to load
FileNotFoundException,
- IOException, ClassNotFoundException
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |