Blue7
Blue7

Reputation: 2044

How to use the custom neural network function in the MATLAB Neural Network Toolbox

I'm trying to create the neural network shown below. It has 3 inputs, 2 outputs, and 2 hidden layers (so 4 layers altogether, or 3 layers of weight matrices). In the first hidden layer there are 4 neurons, and in the second hidden layer there are 3. There is a bias neuron going to the first and second hidden layer, and the output layer.

enter image description here

I have tried using the "create custom neural network" function in MATLAB, but I can't get it to work how I want it to.

This is how I used the function

net1=network(3,3,[1;1;1],[1,1,1;0,0,0;0,0,0],[0,0,0;1,0,0;0,1,0],[0,0,0])
view(net1)

And it gives me the neural network shown below:

enter image description here

As you can see, this isn't what I want. There are only 3 weights in the first layer, 1 in the second, 1 in the output layer, and only one output. How would I fix this?

Thanks!


Just to clarify how I want this network to work:

Upvotes: 0

Views: 5509

Answers (1)

Blue7
Blue7

Reputation: 2044

After some time playing around I've figured out how to do it. The code I needed to use is:

net = newff([0 1; 0 1; 0 1],[4,3 2],{'logsig','logsig','logsig'})
view(net)

This creates the network I was looking for.

enter image description here

I was originally mistaken about the matlab representation of neural networks. The green arrows show the path of all of the numbers, not just a single number.

Upvotes: 2

Related Questions