How to Initialize the weights randomly and train for 20 different sets of initial weights?
Show older comments
Hii all
I have a problem in neural network and i am stuck with that. First of all this is my first experience in NN as well as in this blog. Let me thank everyone in advance.
I am using matlab 2012 for my problem. I have four set of gray scale images. I would like to make these image pixels (from each four Images) as my input. I have extracted the values of each pixel and maid it as 4*200000 matrix. For these corresponding inputs I have 1*200000 matrix as my target.
I have tried using hidden layer size as [10 10]. I could edit the mfile to give
hiddenLayerSize = [10 10];
net = fitnet(hiddenLayerSize);
% net = feedforwardnet;
% net = feedforwardnet([40 10]);
% net = configure(net,inputs,targets);
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'tansig';
% net.layers{3}.transferFcn = 'tansig';
net.layers{3}.transferFcn = 'purelin';
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 80/100;
net.divideParam.valRatio = 10/100;
net.divideParam.testRatio = 10/100;
% Train the Network
[net,tr] = train(net,inputs,targets);
% Test the Network
outputs = net(inputs);
errors = gsubtract(targets,outputs);
performance = perform(net,targets,outputs)
% View the Network
view(net)code
end
In this I have a confusion in selection of NN "net = feedforwardnet or net = feedforwardnet or net=fitnet??
I could get a solution for fitnet but How to understand it is trained well??
Its too slow in training ( May be due to large training set)Any suggestions?
I have converted every input in between -1 and 1 using mapminmax then shuffled accordingly for avoiding memorization of NN.
Every training for the same input and target resulted in different answers as expected. But how to initialize the weights randomly for 20 different sets and train them together and identify the best out of it?
Thanks For your valid time
2 Comments
Greg Heath
on 7 Dec 2013
I do not understand what you are trying to do AND why you think a neural network should be used to obtain a solution?
Please explain what you are trying to do without mentioning neural networks.
There are several problems with your code.
However, let's first get it straight as to
1. What are you trying to do?
2. Why?
Greg
hari prasad
on 8 Dec 2013
Accepted Answer
More Answers (1)
Greg Heath
on 8 Dec 2013
As far as answering the questions in the title:
1. Random weight initialization is a default
2. Search using
greg Ntrials
Thank you for formally accepting my answer
Greg
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!