Expression of ANN Model

I am a beginner of Matlab. I developed several ANN model via "nftool" but I could not find the expression of those models. Although I know that I can use them via "sim" to get outputs, I do need mathematical expression because only with the expression can I see the correlation of input variables. Is there any approach I can use to extract the expression?

 Accepted Answer

Shashank Prasanna
Shashank Prasanna on 2 Jul 2013

0 votes

Neural Network is a non parametric modelling techniques therefor you won't have a nice simple looking expression but you can view the network:
It will show you how many layers are there and the number of neurons.
The expression you are talking about can be quite complex based on the number of layers and neurons. These are just comprised of weights for each neuron that can be accessed from the net object:

1 Comment

jiao
jiao on 5 Jul 2013
Edited: jiao on 5 Jul 2013
My version is 2010a, so I cannot find a getwb function. Instead, I find a getx function which gets a network's weight and biases as a vector of values. What I am looking for is the weights for each variable (column). Is that possible in Matlab?

Sign in to comment.

More Answers (1)

The standard MLP for regression and curve-fitting is FITNET. The standard MLP for classification and pattern-recognition is PATTERNNET; Both call the generic MLP FEEDFORWARDNET.
Duplicating the functionality by writing explicit code is made difficult by default operations that are under the hood . For example,
1. inputs and targets are preprocessed, normalized and randomly divided into training, validation and testing subsets.
2. Initial weights are randomly assigned
3. outputs are unnormalized and postprocessed.
If you just want to replicate the overall I/O function (and not the training), you only have to consider the default mapminnmax normalizations:
close all,clear all, clc
[x,t] = simplefit_dataset;
net = fitnet; % H=10 default
[ net tr y0 ]= train(net,x,t);
[ I N ] = size(x) % [ 1 94]
[ O N ] = size(t) % [ 1 94]
IW = net.IW{1,1} % [ H I ]
b1 = net.b{1} % [ H 1 ]
LW = net.LW{2,1} % [ O H ]
b2 = net.b{2} % [ O 1 ]
[ xn, xsettings ] = mapminmax(x);
[ tn, tsettings ] = mapminmax(t);
yn = repmat(b2 ,1,N) + LW*tansig( repmat(b1,1,N) + IW*xn );
y = mapminmax('reverse', yn, tsettings);
err = max(abs(y-y0))
%trn/val/tst decompositions can be obtained using tr.trainInd, tr.valInd and tr.testInd
P.S. If you want to duplicate runs, inititalize the RNG before the call of train

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!