On Mar 4, 4:36 pm, "Marco Wu" <alwaysma...@hotmail.com> wrote:
> Dear all,
>
> I am new to neural network toolbox. Please help me on this questions. I actually have 2 questions. The first one is concept base. The 2nd one is syntax base.
>
> I have 256 input channels and 10 output categories.
Uhoh: Input dimensionality reduction is probably needed.
>What network should I use if I have to make sure that 1 and only 1 output category will be selected every >time?
It depends on what version you are using. For an IHO (e.g., 256
H10) node topology
[ I N ] = size(p)
[ O N ] = size(t)
Neq = N*O % Number of training equations
1, Ancient NEWFF net = newff( minmax(p), [ H O ] ) ;
2. Old NEWFF net = newff( p, t, H ) ;
3. New PATTERNET net = patternnet( H ) ;
Details can be obtained by the commands lookfor, help and doc .
The output activation function can be PURELIN, LOGSIG, or SOFTMAX and
the outputs can be considered estimates of the input conditional
posterior class probabilities.
The key is to use columns of the 10dimensional unit matrix eye(10) in
the target matrix t to indicate the true class index of the
corresponding input vector in p.
t = ind2vec(trueclassind)
help ind2vec
doc ind2vec
For classification, the input vector is assigned to the class
corresponding to the output node with the maximum value.
assignedclassind = vec2ind(y)
The error counts and percentages can be obtained from
Nerr = 0.5*sum(abs(tcompet(y))) % help compet,
doc compet
Pcterr = 100*Nerr/Neq
> ***THE SECOND QUESTION*********************************
>
> I got error after I run my simple code. Thanks
>
> Here is my code
>
> input_training_data = HandWritingData(random_list,:)'; %size = [256X788]
> target_training_data = Category(random_list,:)'; %size = [10x788]
Again: The output columns are columns of eye(10)
> net = newff(minmax(input_training_data), [15 10], {'logsig','logsig'} , 'hardlim' ); %create a network
Why H = 15?
Try
rand('state',0)
Ntrials = 10
j=0
for h = Hmin:dH:Hmax % Preferrably Hmax << (NeqO)/
(I+O+1)
j = j+1
H = h
for i =1:Ntrials
net = newff(minmax(p),[ H 10 ]);
net.trainParam.goal = 0.01*mean(var(t')');
[ net tr Y ] = train(net,p,t);
Nerr(i,j) = 0.5*sum(abs(tcompet(Y)));
end
end
% Tabulations to choose the best design
H = Hind:dH:Hmax
Pcterr = Nerr/Neq
Hope this helps
Greg
