Reputation: 496
Hi I have trained multilayer perceptron on iris data set in weka tool. It gives me following model as a result.
=== Run information ===
Scheme:weka.classifiers.functions.MultilayerPerceptron -L 0.3 -M 0.2 -N 500 -V 0 -S 0 -E 20 -H a -G -R
Relation: iris
Instances: 150
Attributes: 5
sepallength
sepalwidth
petallength
petalwidth
class
Test mode:split 66.0% train, remainder test
=== Classifier model (full training set) ===
Sigmoid Node 0
Inputs Weights
Threshold -3.5015971588434014
Node 3 -1.0058110853859945
Node 4 9.07503844669134
Node 5 -4.107780453339234
Sigmoid Node 1
Inputs Weights
Threshold 1.0692845992273177
Node 3 3.8988736877894024
Node 4 -9.768910360340264
Node 5 -8.599134493151348
Sigmoid Node 2
Inputs Weights
Threshold -1.007176238343649
Node 3 -4.2184061338270356
Node 4 -3.626059686321118
Node 5 8.805122981737854
Sigmoid Node 3
Inputs Weights
Threshold 3.382485556685675
Attrib sepallength 0.9099827458022276
Attrib sepalwidth 1.5675138827531276
Attrib petallength -5.037338107319895
Attrib petalwidth -4.915469682506087
Sigmoid Node 4
Inputs Weights
Threshold -3.330573592291832
Attrib sepallength -1.1116750023770083
Attrib sepalwidth 3.125009686667653
Attrib petallength -4.133137022912305
Attrib petalwidth -4.079589727871456
Sigmoid Node 5
Inputs Weights
Threshold -7.496091023618089
Attrib sepallength -1.2158878822058787
Attrib sepalwidth -3.5332821317534897
Attrib petallength 8.401834252274096
Attrib petalwidth 9.460215580472827
Class Iris-setosa
Input
Node 0
Class Iris-versicolor
Input
Node 1
Class Iris-virginica
Input
Node 2
Time taken to build model: 34.13 seconds
I'm new to weka I dont understand how are nodes numbered in this? and why is there need of threshold when we are using sigmoid. Can there be multiple attributes in output?
Upvotes: 1
Views: 2008
Reputation: 66815
There are 3 output nodes (0, 1, 2) and 3 hidden units (3, 4, 5). You can differentiate by looking at what are they connected to, for example
Sigmoid Node 3
Inputs Weights
Threshold 3.382485556685675
Attrib sepallength 0.9099827458022276
Attrib sepalwidth 1.5675138827531276
Attrib petallength -5.037338107319895
Attrib petalwidth -4.915469682506087
is clearly a hidden node as it is connected to input attributes. Thus node connected to this one is in next layer (0, 1, 2).
In general WEKA numebrs your nodes from the output layer to the input layer, thus you first get outptu nodes, then the ones connected to them, then previous layer, previous... and finally first hidden layer.
Why is there threshold? Because sigmoid is defined as
sigmoid(w,x,b) = 1/(1+exp(-(<w,x>-b)))
and b
is the threshold. Without it, each node would answer the exact same output for x=0 no matter what are the weights.
Upvotes: 2