edu.rice.comp440.net
Class NeuralNetwork
java.lang.Object
|
+--edu.rice.comp440.net.NeuralNetwork
- public class NeuralNetwork
- extends java.lang.Object
- implements java.io.Serializable
- See Also:
- Serialized Form
Constructor Summary |
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. |
Method Summary |
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 |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
random
public static final java.util.Random random
input
public InputUnit[] input
hidden
public HiddenUnit[][] hidden
NeuralNetwork
public NeuralNetwork(int input,
int[] hidden)
- Builds a neural network with the given number of input
units, hidden units, and output units. Thus, calling
new NeuralNetwork(10, new int[] {20, 5});
creates a neural network with 10 input units, a layer of
20 hidden units, and then 5 output units.
- Parameters:
input
- The number of input unitshidden
- The number of hidden units, as well as the number of layers
NeuralNetwork
public NeuralNetwork(NeuralNetwork net)
- Builds a neural network based on the provided network and
copies the weights of the provided network into the new one.
- Parameters:
net
- The network to base it off of
getValue
public double[] getValue(double[] input)
- Calculates the network value given the provided input
- Parameters:
input
- The input to check- Returns:
- The network value from this input
writeTo
public void writeTo(java.lang.String filename)
throws java.io.IOException
- Method which writes this network to the given file
- Parameters:
file
- The file to write to
readFrom
public static NeuralNetwork readFrom(java.lang.String filename)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Method which reads and returns a network from the given file
- Parameters:
filename
- The file to read from