Training feedforward neural network

3 views (last 30 days)
ASAD ULLAH
ASAD ULLAH on 13 Apr 2016
Answered: Greg Heath on 19 Apr 2016
I have two gaussian distribution samples, one guassian contains 10,000 samples and the other gaussian also contains 10,000 samples, I would like to train a feed-forward neural network with these samples but I dont know how many samples I have to take in order to get an optimal decision boundary. Here is the code but I dont know exactly the solution and the output are weirds.
x1 = -49:1:50;
x2 = -49:1:50;
[X1, X2] = meshgrid(x1, x2);
Gaussian1 = mvnpdf([X1(:) X2(:)], mean1, var1);// for class A
Gaussian2 = mvnpdf([X1(:) X2(:)], mean2, var2);// for Class B
net = feedforwardnet(10);
G1 = reshape(Gaussian1, 10000,1);
G2 = reshape(Gaussian2, 10000,1);
input = [G1, G2];
output = [0, 1];
net = train(net, input, output);
When I ran the code it give me weird results. If the code is not correct, can someone please suggest me so that I can get a decision boundary for these two distributions.

Answers (1)

Greg Heath
Greg Heath on 19 Apr 2016
For N I-dimensional input vectors from c classes, the corresponding N target vectors are {0,1} c-dimensional unit vectors:
[ I N ] = size(input)
[ c N ] = size(target)
where
target = ind2vec(trueclassindices)
and
trueclassindices = vec2ind(target)
Hope this helps.
Thank you for formally accepting my answer
Greg

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!