Maths Tools for Cognitive Scientists Lab 3 (Week 4)

Part b

http://www.informatics.sussex.ac.uk/users/bg22/mtcs/mtcs3b.html

  1. Flow patterns:

     

  2. Using matrices for the weights of a neural network:

    Create a function < ff_net > which creates a fully-connected feed-forward network.
    Three arguments to the function specify the number < i > of input nodes, < h > hidden nodes and < o > outputs.

    For example, a network with 100 inputs, 30 hidden nodes and 1 output would have the architecture
    shown below:

    The function should return 2 matrices which correspond to the weights on the input layer and hidden layer.
    The weights can be initialised using the built-in < randn > function.

  3.  

  4. Optional: create a function to calculate the network output, given its input

    Create a new function < net_input > which has one argument, < input > which is a vector
    (a matrix with one row) - a single set of inputs to the network.

    The < net_input > function should call the < ff_net > function to create a network with
    5 inputs, 3 hidden nodes and 1 output.

    The < net_input > function should then use the weight matrices returned by the
    < ff_net > function to calculate the activation of the hidden nodes.
    (Hint: Use matrix multiplication to multiply the < inputs > by the < weights > )

    Calculate the output of the hidden nodes using the logistic sigmoid function

    where x is the activation.

    In a similar manner calculate the output of the output node, and make this
    the value that the < net_input > function returns.

    Now test the function with the input [1 2 1 4 3].

  5.