Class: MachineLearningWorkbench::NeuralNetwork::FeedForward
- Defined in:
- lib/machine_learning_workbench/neural_network/feed_forward.rb
Overview
Feed Forward Neural Network
Instance Attribute Summary
Attributes inherited from Base
#act_fn, #act_fn_name, #layers, #state, #struct
Instance Method Summary collapse
-
#activate_layer(i) ⇒ Object
Activates a layer of the network.
-
#layer_row_sizes ⇒ Array<Integer>
Calculate the size of each row in a layer’s weight matrix.
Methods inherited from Base
#activate, #deep_reset, #init_random, #initialize, #interface_methods, #layer_col_sizes, #layer_shapes, #lecun_hyperbolic, #load_weights, #nlayers, #nneurs, #nweights, #nweights_per_layer, #out, #relu, #reset_state, #sigmoid, #weights
Constructor Details
This class inherits a constructor from MachineLearningWorkbench::NeuralNetwork::Base
Instance Method Details
#activate_layer(i) ⇒ Object
Activates a layer of the network
16 17 18 |
# File 'lib/machine_learning_workbench/neural_network/feed_forward.rb', line 16 def activate_layer i act_fn.call(state[i].dot layers[i]) end |
#layer_row_sizes ⇒ Array<Integer>
Calculate the size of each row in a layer’s weight matrix. Includes inputs (or previous-layer activations) and bias.
10 11 12 |
# File 'lib/machine_learning_workbench/neural_network/feed_forward.rb', line 10 def layer_row_sizes @layer_row_sizes ||= struct.each_cons(2).collect {|prev, _curr| prev+1} end |