Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Neural Network toolbox, how to predict?

Subject: Neural Network toolbox, how to predict?

From: Hao

Date: 23 Oct, 2012 11:19:08

Message: 1 of 2

Hello everyone,

I am using Neural Network toolbox to do pattern recognition, but now I have a problem. I have already trained the neural network. To do the pattern recognition, I will test the network. I have a set of 100 testing samples of 4 classes, each of which has the format as follows:

feature set: feature 1, feature 2,feature 3,feature 4,feature 5,.................
target: 1 0 0 0 (for example)

that is to say, the input of the network is the feature set, and the output should have 4 binary values, only one of which is 1, in order to predict the specified class.

However, the actual output of the network is usually like:
0.9844, 0.0000, 0.2311, 0.085

In this case, how can I convert the output into binary values? How can I decide which class does this sample belong to?

Thank you very much in advance.

Best regards,
Hao

Subject: Neural Network toolbox, how to predict?

From: Greg Heath

Date: 24 Oct, 2012 11:33:08

Message: 2 of 2

"Hao " <weihao.hello@gmail.com> wrote in message <k65ufb$s1f$1@newscl01ah.mathworks.com>...
> Hello everyone,
>
> I am using Neural Network toolbox to do pattern recognition, but now I have a problem. I have already trained the neural network. To do the pattern recognition, I will test the network. I have a set of 100 testing samples of 4 classes, each of which has the format as follows:
>
> feature set: feature 1, feature 2,feature 3,feature 4,feature 5,.................
> target: 1 0 0 0 (for example)

No.

The inputs and targets are column vectors.

The target vectors are columns of eye(4). For example.

t = ind2vec( [ 1 2 3 4 3 2 1 ])

The output vectors will be columns of y = t + error

The assigned classes are obtained from

classes = vec2ind(y)

> that is to say, the input of the network is the feature set, and the output should have 4 binary values, only one of which is 1, in order to predict the specified class.
>
> However, the actual output of the network is usually like:
> 0.9844, 0.0000, 0.2311, 0.085
>
> In this case, how can I convert the output into binary values? How can I decide which class does this sample belong to?
 
class = vec2ind( [0.9844, 0.0000, 0.2311, 0.085]') % Note the transpose

Hope this helps.

Greg

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us