I have a problem which is multiclass e.g. That is 4 classes. I would like a custom metric to assess the model where only if class 3 is predicted as class 2 and class 2 is predicted as class 3 (i.e. those in the middle) then it is penalized less.

How can i do this by adapting the sklearn accuracy_score metric of similar?

e.g. comparing:

predicted_labels = [1,3,0,0,2..]
actual = [0,0,2,1,3,3...]
  • 1
    $\begingroup$ Can you apply a weighting system? $\endgroup$ Nov 16 at 14:05
  • $\begingroup$ Maybe I don't understand but why not implementing a custom evaluation function? $\endgroup$
    – Erwan
    Nov 16 at 18:25
  • $\begingroup$ how can i do that $\endgroup$
    – Maths12
    Nov 19 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.