Database Reference
In-Depth Information
These layers are then assembled into a neural network with the
NeuralNetwork class. This class maintains an array of layers, which
includes, at the minimum, an output layer. Most networks also contain a
hidden layer, and some contain several hidden layers. It is not necessary to
define a discrete input layer, just the number of units in the layer, because
its activation function is the identity function:
NOTE
“Deep learning” refers to neural networks with more than one hidden
layer. It may also refer to the practice of stacking neural networks
together.
public class NeuralNetwork {
int inputUnits = 0;
ArrayList<Layer> layers = new ArrayList<Layer>();
public NeuralNetwork inputs( int inputUnits) {
this .inputUnits = inputUnits;
return this ;
}
To define each subsequent layer, the NeuralNetwork class inspects the
previous layer (or the number of inputs) to determine the size of the weight
matrix to be used:
public NeuralNetwork layer( int units,Activation
fn, boolean bias) {
int inputs = (layers.size() == 0) ?
this .inputUnits :
layers.get(layers.size()-1).units();
layers.add( new Layer(units,inputs,fn,bias));
return this ;
}
public NeuralNetwork layer( int units,Activation fn) {
return layer(units,fn, true );
}
public NeuralNetwork layer( int units) {
Search WWH ::




Custom Search