Making a Neural Network
Show older comments
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.
Accepted Answer
More Answers (1)
Sergio
on 16 May 2013
0 votes
Categories
Find more on Deep Learning Toolbox 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!