public static class FeedForwardNetwork.Builder extends Object
FeedForwardNetwork
instance.
Provides methods for setting all the components of a feed forward neural network and
performs basic validation of settings in order to prevent illegal configuration.FeedForwardNetwork
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
FeedForwardNetwork.Builder |
addFullyConnectedLayer(int layerWidth)
Adds to the network a fully connected layer with specified width and Relu activation function by default.
|
FeedForwardNetwork.Builder |
addFullyConnectedLayer(int layerWidth,
ActivationType activationType)
Adds fully connected addLayer with specified width and activation
function to the network.
|
FeedForwardNetwork.Builder |
addHiddenFullyConnectedLayers(ActivationType activationType,
int... layerWidths)
Adds fully connected hidden layers with widths given in layerWidths param and given activation function type.
|
FeedForwardNetwork.Builder |
addHiddenFullyConnectedLayers(int... layerWidths)
Adds to the network several hidden fully connected layers with specified widths and default hidden activation function by default.
|
FeedForwardNetwork.Builder |
addInputLayer(int layerWidth)
Adds input layer with the specified layerWidth (number of inputs) to the network.
|
FeedForwardNetwork.Builder |
addLayer(AbstractLayer layer)
Adds custom layer to this network (which inherits from AbstractLayer)
|
FeedForwardNetwork.Builder |
addOutputLayer(int width,
ActivationType activationType)
Adds output layer to the neural network with specified width (number of outputs) and activation function type.
|
FeedForwardNetwork |
build()
Builds an instance of FeedForwardNetwork with settings specified in this builder.
|
FeedForwardNetwork.Builder |
hiddenActivationFunction(ActivationType activationType)
Sets default type of the activation function to use for all hidden layers in the network.
|
FeedForwardNetwork.Builder |
lossFunction(LossType lossType)
Sets loss function to be used by created neural network.
|
FeedForwardNetwork.Builder |
randomSeed(long seed)
Initializes random number generator with the specified seed in order to
get same random number sequences used for weights initialization.
|
public FeedForwardNetwork.Builder addInputLayer(int layerWidth)
layerWidth
- width of the input layer that corresponds to the number of network's inputspublic FeedForwardNetwork.Builder addFullyConnectedLayer(int layerWidth)
layerWidth
- width of the layer / number of neuronsFullyConnectedLayer
public FeedForwardNetwork.Builder addHiddenFullyConnectedLayers(int... layerWidths)
layerWidths
- an array with widths for hidden fully connected layers.FullyConnectedLayer
public FeedForwardNetwork.Builder addFullyConnectedLayer(int layerWidth, ActivationType activationType)
layerWidth
- width of the layer to addactivationType
- type of the activation function for layer to addActivationFunction
public FeedForwardNetwork.Builder addHiddenFullyConnectedLayers(ActivationType activationType, int... layerWidths)
activationType
- type of activation function in hidden layerslayerWidths
- widths of the hidden layerspublic FeedForwardNetwork.Builder addLayer(AbstractLayer layer)
layer
- public FeedForwardNetwork.Builder addOutputLayer(int width, ActivationType activationType)
width
- layer with which corresponds to number of network's outputsactivationType
- type of the activation function to use in output layerpublic FeedForwardNetwork.Builder hiddenActivationFunction(ActivationType activationType)
activationType
- type of activation functionActivationType
public FeedForwardNetwork.Builder lossFunction(LossType lossType)
lossType
- type of a loss functionpublic FeedForwardNetwork.Builder randomSeed(long seed)
seed
- public FeedForwardNetwork build()
Copyright © 2022. All rights reserved.