6
votes

I'm trying to use Multi-Perceptron in Weka Knowledge Flow. In the attachment you can see the setting for the block. As written in the help: "hiddenLayers -- This defines the hidden layers of the neural network. This is a list of positive whole numbers. 1 for each hidden layer. Comma seperated. To have no hidden layers put a single 0 here. This will only be used if autobuild is set. There are also wildcard values 'a' = (attribs + classes) / 2, 'i' = attribs, 'o' = classes , 't' = attribs + classes."

However, it's still a little bit confusing for me. How can I build a neural network with 3 hidden layers, each has different number of units (say 2,5,6). And can you help explain wildcard values? I think it's only for number of hidden layers, not for number of hidden units in each layer.

Thank you.enter image description here

1
I messed around with the MultilayerPerceptron in the explorer, and found that you can provide comma separated numbers for the number of units for each layer. This means that '2,5,6' makes 3 hidden layers, left to right, with 2, 5, and 6 nodes per layer.NBartley

1 Answers

11
votes

The GUI option will help you work through this. If you supply '2,5,6' to the hidden layers, it will create 3 layers with 2, 5, and 6 units respectively. The wildcard values seem to be shortcuts for the numbers they represent (a = (# of attributes + # of classes) / 2 , etc). Here are a couple visual steps representing what I mean.


You can see the 'a, 2, 5, 6' in hiddenLayers. enter image description here

a = # of attributes + # of classes / 2

There are 6 attributes and 1 class, so a = 7 / 2 = 3

This means that we expect to see 3 units in the first hidden layer, then 2, 5, and 6, followed by the 1 unit in the output layer.

enter image description here