Making a Neural Network

Hello everyone and thanks for your time!
I'm trying to build a neural network in order to get a relation between some physical properties of a material. The code I've been using is the following:
load ./DataFinalModel/data.txt
% 1st column is (D) % 2nd column is density % 3rd column is rest compressio % 4th column is rest flexio % 5th column is mod young
Nsamples = length(data);
%% Structure the data
m1 = data(1:Nsamples,2); m2 = data(1:Nsamples,3); m3 = data(1:Nsamples,4); m4 = data(1:Nsamples,5); r1 = data(1:Nsamples,1); %% Build the network
p = [m1';m2';m3';m4'];
t = [r1'];
neuronstotal = 10;
transferFunction = 'purelin';
hiddenLayers = 1;
net = newff(p,t,neuronstotal);
net.trainFcn = 'trainscg';
net.trainParam.show = 10;
net.trainParam.lr = 0.1;
net.trainParam.epochs = 100;
net.trainParam.goal = 1e-10;
net.trainParam.min_grad = 1e-15;
net.layers{1}.transferFcn = transferFunction;
net.performFcn = 'mse';
net.outputs{2}.processFcns = {'mapminmax'};
net.inputs{1}.processFcns = {'mapminmax'};
% Test data
index = 2:6:116;
m1t = data(index,2);
m2t = data(index,3);
m3t = data(index,4);
m4t = data(index,5);
r1t = data(index,1);
ptest = [m1t';m2t';m3t';m4t'];
ttest = [r1t'];
test = sim(net,ptest);
rel_err1 = (r1t' - test)./r1t' * 100;
rms_relerror1 = sqrt(sum(1/20*rel_err1.^2))
mean1 = mean(rel_err1)
std1 = std(rel_err1)
xaxis = 1:1:20;
I need the weights and the bias matrix, but I cannot get'em. Also, I need the mapminmax output.
Again, thank you for your time.

 채택된 답변

Greg Heath
Greg Heath 2013년 5월 14일

0 개 추천

1. NEWFF is obsolete . What version of MATLAB and NNTBX are you using? Type the command
ver
2. You have made the solution too complicated. See the examples in the documentation
help newff; doc newff
In particular,
a. Understand what properties are defaults
b. Practice on a MATLAB nndataset with dimensions similar to yours
before using your own data set
help nndatasets
c. Start by using all of the defaults. Then change if needed.
3. Too much transposing. Only have to transpose once:
data = data';
t = data(1,:);
p = data(2:5,:);
whos % check
4. You never trained your net.
5. Find code examples in the NEWSGROUP or ANSWERS by searching on
greg newff
Hope this helps.
Thank you for formally accepting my answer
Greg
Greg

추가 답변 (1개)

Sergio
Sergio 2013년 5월 16일

0 개 추천

Thank you very much!

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

질문:

2013년 5월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by