How to use a trained neural network in Matlab for classification in a real system

I prepared Feed Forward NN using the Neural Network Matlab toolkit in a dataset containing speech functions and accelerometer measurements. The Targetset contains two target classes for the dataset: 0 and 1. Training, verification, and performance are all fine, and I created code for this network.

Now I need to use this neural network in real time to recognize the pattern when it occurs and generate 0 or 1 when I test a new dataset against a previously trained NN. But when I issue the command:

c = sim(net, j) 

Where "j" is the new data set [24x11]; instead of 0 or 1, I get this as the result (I assume that I get the percentage of the correct classification, but the classification result itself is missing):

 c = Columns 1 through 9 0.6274 0.6248 0.9993 0.9991 0.9994 0.9999 0.9998 0.9934 0.9996 Columns 10 through 11 0.9966 0.9963 

So, is there any team or way that I can really see the classification results? Any help is much appreciated! Thanks

+4
source share
2 answers

I am not a Matlab user, but logically, you are missing an important point:

Input into a neural network is one vector, you transmit a matrix. So Matlab thinks you want to classify a bunch of vectors (11 in your case). So the vector you get is the activation of the output for each of these 11 vectors.

Activating output is a value from 0 to 1 (suppose you are using a sigmoid), so this is perfectly normal. Your task is to get the threshold that best suits your data. You can get this threshold with cross-validation on your training / test data or simply by selecting one (0.5?) And see if the results are “good” and change if necessary.

+4
source

NNs usually convert their output into a value inside (0,1), using, for example, a logistic function. This is not a percentage or probability, but only a relative measure of confidence. In any case, this means that you must manually use a threshold (e.g. 0.5) to distinguish between the two classes. Which threshold is best to find is difficult because you have to choose the best compromise between accuracy and recall.

+2
source

All Articles