I have a dataframe. first column contains my the predictive score (range from 0 to 100, smaller values is expected to be in class A, larger values is expected to be in class B) for my model, 2nd column contains the real classification of the entries (either “class A” or “class B”).
How to get confusion matrix with R for different cut off values, as I cannot decide where I should define values < 20 or < 50 as class A yet?
How to do this comparison efficiently with R?
There’s a number of ways to do this, a reproducible example with your data would have been desirable:
gives
So this says 32 A’s were under 50 and 34 B’s were over 50, while 18 A’s were over 50 (wrongly classified) and 16 B’s were under 50 (wrongly classified)
gives
In this example, cause of the chosen sampling, your classification is much better.
The ’50’ in this can then be changed to anything you want, 20, 30, etc.