Message Boards Message Boards

0
|
3667 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Find accuracy for a neural network?

Hallo, I defined the following network

net = NetChain[Flatten@Table[{LinearLayer[50], ElementwiseLayer[Tanh]}, 3]]
net = NetJoin[net, {LinearLayer[9]}]

the input are arrays of Length 10 and the outputs are arrays of length 9. And I trained it successfully as:

trainednet = NetTrain[net, train, ValidationSet -> test, MaxTrainingRounds -> 500]

I'm trying to find the accuracy of the net so I used the following:

res = NetTrain[net, train, All, TrainingProgressMeasurements -> {"Accuracy"}]

But I got the following error message:

NetTrain::nometriclayer: One or more measurements require a CrossEntropyLossLayer to be present in the training net, but there are none.

I tried to add CrossEntropyLossLayer, but Smth is going wrong. Can you recommend how I got the accuracy of such net. Thanx in advance.

POSTED BY: Maha Youssef
2 Replies

Still the same problem:

In[122]:= NetMeasurements[net, testdata, "Accuracy"]

Out[122]= $Failed
POSTED BY: Maha Youssef
Posted 4 years ago

Hi Maha,

You need to run the trained net on test data to assess the accuracy and other metrics. Split your data into e.g. 80% train, 10% validation and 10% test. Use the train and validation data during training and then run NetMeasurements on the test data. Check the documentation for examples.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract