Clear Filters
Clear Filters

How to add custom accuracy function in Matlab's inbuilt shallow neural network patternnet function for each iteration

5 views (last 30 days)
I am using matlab's patternnet function to compare my custom neural net classifier.
After initializing the network as "net = patternnet(2,'trainscg')", we train the classifier using "[trainedNet,tr] = train(net,X,T,Xi,Ai,EW)" function where the 'tr' output function gives me training error, validation error and testing error. How can i add a custom function that calculates accuracy and saves the accuracy in the tr function similar to the error values that are stored for every iteration. Thanks in advance

Answers (1)

Shashank Gupta
Shashank Gupta on 30 Dec 2020
Hi Chinmay,
I am afraid there is no straight forward way to do what you are intending to do. Although you can find out the accuracy after the training is completed. That should give you a way to compare your model with another network. Even if your sole purpose is to compare different classifier, you can do so using the loss too. The loss matrix provides the same feel.
Cheers.
  1 Comment
Chinmay Rane
Chinmay Rane on 8 Jan 2021
Thank you for your reply. I wanted to check the accuracy for each iteration for LM algorithm. I understand that i can use the final accuracy to compare the model but i wanted to see if i can add a custom metric just as similar to custom loss metric i can add in the matlab network code. Anyways thanks i coded LM from scratch to compare. Thanks for your reply
Chinmay

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!