Help for mathematical equation of regression in ANN

3 次查看(过去 30 天)
With ANN toolbox, I am using neural networks for finding the regression equation.
for info, I am using Bayesian regularization with 4 variables of 30 different samples and 30 results.
Is there a way of finding the mathematical equation of that in ANN?
Thanks..

采纳的回答

Greg Heath
Greg Heath 2012-5-16
This question has been asked many times in both the Newsgroup and Answers. If you do not use the default normalizations of input and output,
h = tansig(IW*x+b1);
y = purelin(LW*h+b2);
Otherwise you have to use the default mapminmax or alternative mapstd on x,t and y.
You can obtain details by searching on the equation for h in the Newgroup and Answers.
Hope this helps.
Greg

更多回答(4 个)

b
b 2012-5-16
Thank you so much but,
inputs = initial1';
targets = output';
hiddenLayerSize = 30;
net = newff(minmax(input),[1 10],{'tansig' 'purelin'},'trainbr');
net.IW{1}
net.b{1,1}
h=tansig(IW*inputs+b1)
targets=purelin(LW*h+b2)
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 80/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 5/100;
net.trainFcn = 'trainbr'; % Bayesian Regularization
net.performFcn = 'mse'; % Mean squared error
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression', 'plotfit'};
[net,tr] = train(net,inputs,targets);
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
trainTargets = targets .* tr.trainMask{1};
valTargets = targets .* tr.valMask{1};
testTargets = targets .* tr.testMask{1};
trainPerformance = perform(net,trainTargets,outputs)
valPerformance = perform(net,valTargets,outputs)
testPerformance = perform(net,testTargets,outputs)
view(net)
perf = msereg(errors,outputs,X,FP);
dy = msereg('dy',errors,outputs,X,perf,FP);
dx = msereg('dx',errors,outputs,X,perf,FP);
info = msereg(code);
net.performParam.ratio = 20/(20+1);
perf = msereg(e,net);
Gives an error why??
  2 个评论
Greg Heath
Greg Heath 2012-5-16
What is the error?
Did you try to use the debugger?
Greg
b
b 2012-5-17
I am using debugger, but actually,
net.IW{1}
net.b{1,1}
There is an error. I could not solve it.

请先登录,再进行评论。


Greg Heath
Greg Heath 2012-5-16
hiddenLayerSize = 30;
1. TOO LARGE AND INCOMPATIBLE WITH NEXT COMMAND
net = newff(minmax(input),[1 10],{'tansig' 'purelin'},'trainbr');
2. a. OBSOLETE. WHAT VERSION OF MATAB AND NNTBX DO YOU HAVE?
2.b. INCORRECT NODE SIZE ASSIGNNMENT SYNTAX
net.IW{1}
net.b{1,1}
3. ASSIGN WEIGHTS TO IW, LW
h=tansig(IW*inputs+b1)
targets=purelin(LW*h+b2)
4. TERMINATE THIS AND OTHER VOLUMINOUS OUTPUT COMMANDS WITH SEMICOLONS
net.inputs{1}.processFcns = {'removeconstantrows','mapminmax'};
net.outputs{2}.processFcns = {'removeconstantrows','mapminmax'};
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
4. LAST FOUR ARE DEFAULTS: DELETE
net.divideParam.valRatio = 15/100;
5. WHY ARE YOU USING A VALIDATION SET WITH TRAINBR?
net.trainFcn = 'trainbr'; % Bayesian Regularization
6. WHY ARE YOU USING TRAINBR INSTEAD OF DEFAULT TRAINLM?
net.performFcn = 'mse'; % Mean squared error
7. MSE INCOMPATIBLE WITH TRAINBR SEE DOCUMENTATION
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression', 'plotfit'};
8. NOT SURE IF THESE ARE COMPATIBLE WITH YOUR OBSOLETE VERSION OF NEWFF
perf = msereg(errors,outputs,X,FP);
dy = msereg('dy',errors,outputs,X,perf,FP);
dx = msereg('dx',errors,outputs,X,perf,FP);
info = msereg(code);
net.performParam.ratio = 20/(20+1);
perf = msereg(e,net);
9. I HAVE NO IDEA WHAT YOU ARE DOING HERE. YOU NEVER USED MSEREG FOR LEARNING
HOPE THIS HELPS.
GREG

b
b 2012-5-17
hiddenLayerSize=10;
# 1- HIDDENLAYERSIZE 30 CHANGED TO 10.
# 2- MATLAB 2012a.(FORGOT TO ADD IT, SORRY FOR THAT)
net.IW{1}
net.b{1,1}
# 3- WHEN I WROTE getwb(net), IW AND B OCCUR LIKE THAT.
h=tansig(IW*inputs+b1);
targets=purelin(LW*h+b2);
# 4- SEMICOLONS ARE ADDED.
net.trainFcn='trainlm'
# 5- IT IS CHANGED TO 'TRAINLM'. IN MANY ARTICLES, BAYESIAN IS WORKED FOR MEDIA OPTIMIZATION. I CAN USE 'LM' IN MY PROJECT
net.plotFcns = {'plotperform','plottrainstate','ploterrhist', ...
'plotregression', 'plotfit'};
# 6- THEY ARE COMPATIBLE AND WORKING WITHOUT AN ERROR.
dy = msereg('dy',errors,outputs,X,perf,FP);
dx = msereg('dx',errors,outputs,X,perf,FP);
info = msereg(code);
net.performParam.ratio = 20/(20+1);
perf = msereg(e,net);
# 7- THESE FOR OBTAINIG MSEREG AND PERFORMANCE.
CAN I USE 'ADAPT' MSEREG FOR LEARNING.
THANK YOU SO MUCH.
BASAR
  2 个评论
b
b 2012-5-17
The last sentence is not correct.
I misunderstood what you said in your last sentence.

请先登录,再进行评论。


b
b 2012-5-17
Also, in one of your previous answers, you told to use.
help msereg
in the help part, it is explained like that
perf = msereg(errors,outputs,X,FP);
dy = msereg('dy',errors,outputs,X,perf,FP);
dx = msereg('dx',errors,outputs,X,perf,FP);
info = msereg(code);
net.performParam.ratio = 20/(20+1);
perf = msereg(e,net);

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by