NeuralNet v1.0.0 NeuralNet.Backprop

This module provides the code that generates the feedforward and backprop data used for training. get_feedforward can also be used for normal network evaluation, and is used by NeuralNet.eval. get_feedforward returns {output, time_frames}, where output is vector_data. get_backprop returns {error_sum, time_frames}.

vector_data is a map that at its largest contains the keys :values, :partial_derivs, and :backprops. At its smallest, for instance when the network is simply evaluated, with no intention of perfomring backpropogation, it contains only :values. When get_feedforward is evaluated, each vector_data gets its :values term populated with evaluation data, in the form of a map with {component_name, value} key-val-pairs. If calc_partial_derivs is true, :partial_derivs also get filled in. This data is later used for backpropogation. When get_backprop is run, the :backprops keys get filled in with their corresponding data.

time_frames is a list returned by both get_feedforward and get_backprop. Index 1 is the real “beginning of time” (index 0 stores some initial values for vectors used recurrently). Each time_frame is a map of {vector_name, vector_data} key-val-pairs.

Example

iex> get_feedforward(net, input, false)
{
  %{values: %{a: 1.0, b: -0.5, c: -0.6}},
  [
    %{},
    %{input: %{values: %{x: 1.0, y: 0.5}}, output: %{values: %{a: 0.5, b: 0.0, c: -0.9}},
    %{input: %{values: %{x: 0.2, y: -0.6}}, output: %{values: %{a: 0.7, b: -0.3, c: -0.7}},
    %{input: %{values: %{x: 0.7, y: -0.9}}, output: %{values: %{a: 1.0, b: -0.5, c: -0.6}}
  ]
}

Summary

Functions

Fetches vector_data from time_frames at time time, at vector vec

Retrieves backprop data given a network, an input vector-across-time, and exp_outputs. exp_outputs can either be a vector-across-time, or it can just be a single vector, which would be the expected output for the final time frame. Returns {error_sum, time_frames}. For info on a vector-across-time, see the NeuralNet module doc. For info on what time_frames is, see the above module doc

Retrieves feedforward data given a network and an input vector-across-time. Returns {output, time_frames}. For info on a vector-across-time, see the NeuralNet module doc. For info on the return value, see the above module doc. If calc_partial_derivs is false, :partial_derivs data is not calculated

Functions

fetch!(acc, time, vec)

Fetches vector_data from time_frames at time time, at vector vec.

get_backprop(net, input, exp_outputs)

Retrieves backprop data given a network, an input vector-across-time, and exp_outputs. exp_outputs can either be a vector-across-time, or it can just be a single vector, which would be the expected output for the final time frame. Returns {error_sum, time_frames}. For info on a vector-across-time, see the NeuralNet module doc. For info on what time_frames is, see the above module doc.

get_feedforward(net, input, calc_partial_derivs \\ true, given_time_frames \\ [%{}])

Retrieves feedforward data given a network and an input vector-across-time. Returns {output, time_frames}. For info on a vector-across-time, see the NeuralNet module doc. For info on the return value, see the above module doc. If calc_partial_derivs is false, :partial_derivs data is not calculated.