public class NeuralNetwork
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
HiddenUnit[][] |
hidden |
InputUnit[] |
input |
static java.util.Random |
random |
Constructor and Description |
---|
NeuralNetwork(int input,
int[] hidden)
Builds a neural network with the given number of input
units, hidden units, and output units.
|
NeuralNetwork(NeuralNetwork net)
Builds a neural network based on the provided network and
copies the weights of the provided network into the new one.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getValue(double[] input)
Calculates the network value given the provided input
|
static NeuralNetwork |
readFrom(java.lang.String filename)
Method which reads and returns a network from the given file
|
void |
writeTo(java.lang.String filename)
Method which writes this network to the given file
|
public static final java.util.Random random
public InputUnit[] input
public HiddenUnit[][] hidden
public NeuralNetwork(int input, int[] hidden)
input
- The number of input unitshidden
- The number of hidden units, as well as the number of layerspublic NeuralNetwork(NeuralNetwork net)
net
- The network to base it off ofpublic double[] getValue(double[] input)
input
- The input to checkpublic void writeTo(java.lang.String filename) throws java.io.IOException
file
- The file to write tojava.io.IOException
public static NeuralNetwork readFrom(java.lang.String filename) throws java.io.IOException, java.lang.ClassNotFoundException
filename
- The file to read fromjava.io.IOException
java.lang.ClassNotFoundException