public class FeedforwardNeuralNetwork extends AbstractCloneableSerializable implements VectorizableVectorFunction
Constructor and Description |
---|
FeedforwardNeuralNetwork(java.util.ArrayList<? extends GeneralizedLinearModel> layers)
Creates a new instance of FeedforwardNeuralNetwork
|
FeedforwardNeuralNetwork(java.util.ArrayList<java.lang.Integer> nodesPerLayer,
java.util.ArrayList<? extends UnivariateScalarFunction> layerActivationFunctions)
Creates a new instance of FeedforwardNeuralNetwork
|
FeedforwardNeuralNetwork(int numInputs,
int numHiddens,
int numOutputs,
UnivariateScalarFunction activationFunction)
Creates a new instance of FeedforwardNeuralNetwork
|
Modifier and Type | Method and Description |
---|---|
FeedforwardNeuralNetwork |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Converts the object from a Vector of parameters.
|
Vector |
convertToVector()
Converts the object to a vector.
|
Vector |
evaluate(Vector input)
Evaluates the function on the given input and returns the output.
|
protected java.util.ArrayList<Vector> |
evaluateAtEachLayer(Vector input)
Returns the activations that occured at each layer
|
java.util.ArrayList<? extends GeneralizedLinearModel> |
getLayers()
Getter for layers
|
void |
setLayers(java.util.ArrayList<? extends GeneralizedLinearModel> layers)
Setter for layers
|
java.lang.String |
toString() |
public FeedforwardNeuralNetwork(java.util.ArrayList<java.lang.Integer> nodesPerLayer, java.util.ArrayList<? extends UnivariateScalarFunction> layerActivationFunctions)
nodesPerLayer
- Number of nodes in each layer, must have no fewer than 2 layerslayerActivationFunctions
- Squashing function to assign to each layer, must have one fewer squashing
function than you do layers (that is, the input layer has no squashing)public FeedforwardNeuralNetwork(int numInputs, int numHiddens, int numOutputs, UnivariateScalarFunction activationFunction)
numInputs
- Number of nodes in the input layernumHiddens
- Number of nodes in the hidden (middle) layernumOutputs
- Number of nodes in the output layeractivationFunction
- Squashing function to assign to all layerspublic FeedforwardNeuralNetwork(java.util.ArrayList<? extends GeneralizedLinearModel> layers)
layers
- Layers that comprise this neural networkpublic FeedforwardNeuralNetwork clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface Vectorizable
clone
in interface VectorizableVectorFunction
clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public Vector convertToVector()
Vectorizable
convertToVector
in interface Vectorizable
public void convertFromVector(Vector parameters)
Vectorizable
convertFromVector
in interface Vectorizable
parameters
- The parameters to incorporate.public Vector evaluate(Vector input)
Evaluator
protected java.util.ArrayList<Vector> evaluateAtEachLayer(Vector input)
input
- Input to evaluatepublic java.util.ArrayList<? extends GeneralizedLinearModel> getLayers()
public void setLayers(java.util.ArrayList<? extends GeneralizedLinearModel> layers)
layers
- Layers that comprise this neural networkpublic java.lang.String toString()
toString
in class java.lang.Object