Hi Jon,
As you said your NN has 20 inputs, 1 output and 1 hidden layer with 4 nodes. After opening your MyNN.mat, it shown input weight (4x20), layer2 weight (1x4), input bias (4x1), output bias (1x1). I try to formulate your net as follows (hope I am not making wrong explanation).
Input Layer
Your weight input dimensions are 4 x 20, then formula relation between your inputs to the hidden layer will be
I1*w1-1 + I2*w2-1 + I3* w3-1 +...+I20*w20-1 + b1 for node 1 -> assume as x1
I1*w1-2 + I2*w2-2 + I3* w3-2 +...+I20*w20-2 + b2 for node 2 -> assume as x2
I1*w1-3 + I2*w2-3 + I3* w3-3 +...+I20*w20-3 + b3 for node 3 -> assume as x3
I1*w1-4 + I2*w2-4 + I3* w3-4 +...+I20*w20-4 + b4 for node 4 -> assume as x4
where
w1-1 indicates weight at node 1 from input 1,
w2-1 indicates weight at node 1 from input 2,
...
w1-4 indicates wight at node 4 from input 1, etc
b1 is bias for node 1, b2 bias for node 2 etc..
I1 is input 1, I2 input 2, ... I20 is input 20.
Each node then become input for your transfer function, your transfer function is tansig then node 1 result= tansig(x1), node2 result=tansig(x2), etc.
Your bias size is 4x1 and biasconnect= [1;1] means your bias to be added on input layer and layer 2
Layer 2
You have 1 output, means the formula relation between your hidden layer to your output (your output transfer function is purelin) will be
output=purelin(tansig(x1)* v1-1+tansig(x2)* v2-1+tansig(x3)* v3-1+tansig(x4)* v4-1+b2)
v1-1 is weight layer 2 from node 1
v2-1 is weight layer 2 from node 1
v3-1 is weight layer 2 from node 1
v4-1 is weight layer 2 from node 1
b2 is output bias
Something to add as part of your code is for preprocessing your inputs and postprocessing your output (scaling).
Hope you can coding afterward on your mq4 or dll.
As you said your NN has 20 inputs, 1 output and 1 hidden layer with 4 nodes. After opening your MyNN.mat, it shown input weight (4x20), layer2 weight (1x4), input bias (4x1), output bias (1x1). I try to formulate your net as follows (hope I am not making wrong explanation).
Input Layer
Your weight input dimensions are 4 x 20, then formula relation between your inputs to the hidden layer will be
I1*w1-1 + I2*w2-1 + I3* w3-1 +...+I20*w20-1 + b1 for node 1 -> assume as x1
I1*w1-2 + I2*w2-2 + I3* w3-2 +...+I20*w20-2 + b2 for node 2 -> assume as x2
I1*w1-3 + I2*w2-3 + I3* w3-3 +...+I20*w20-3 + b3 for node 3 -> assume as x3
I1*w1-4 + I2*w2-4 + I3* w3-4 +...+I20*w20-4 + b4 for node 4 -> assume as x4
where
w1-1 indicates weight at node 1 from input 1,
w2-1 indicates weight at node 1 from input 2,
...
w1-4 indicates wight at node 4 from input 1, etc
b1 is bias for node 1, b2 bias for node 2 etc..
I1 is input 1, I2 input 2, ... I20 is input 20.
Each node then become input for your transfer function, your transfer function is tansig then node 1 result= tansig(x1), node2 result=tansig(x2), etc.
Your bias size is 4x1 and biasconnect= [1;1] means your bias to be added on input layer and layer 2
Layer 2
You have 1 output, means the formula relation between your hidden layer to your output (your output transfer function is purelin) will be
output=purelin(tansig(x1)* v1-1+tansig(x2)* v2-1+tansig(x3)* v3-1+tansig(x4)* v4-1+b2)
v1-1 is weight layer 2 from node 1
v2-1 is weight layer 2 from node 1
v3-1 is weight layer 2 from node 1
v4-1 is weight layer 2 from node 1
b2 is output bias
Something to add as part of your code is for preprocessing your inputs and postprocessing your output (scaling).
Hope you can coding afterward on your mq4 or dll.
Last edited: