Expression of ANN Model
Show older comments
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
More Answers (1)
Greg Heath
on 3 Jul 2013
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
Categories
Find more on Pattern Recognition in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!