Product

Friday, 15 March 2024

Do Not Use Random Guessing As Your Baseline Classifier

 I recently received the following question via email:

Hi Jason, quick question. A case of class imbalance: 90 cases of thumbs up 10 cases of thumbs down. How would we calculate random guessing accuracy in this case?

We can answer this question using some basic probability (I opened excel and typed in some numbers).Let’s get started.

Note, for a more detailed tutorial on this topic, see:

  • How to Develop and Evaluate Naive Classifier Strategies Using ProbabilityLet’s say the split is 90%-10% for class 0 and class 1. Let’s also say that you will guess randomly using the same ratio.

    The theoretical accuracy of random guessing on a two-classification problem is:

    We can test this on our example 90%-10% split:

    To check the math, you can plug-in a 50%-50% split of your data and it matches your intuition:

    If we look on Google, we find a similar question on Cross Validated “What is the chance level accuracy in unbalanced classification problems?” with an almost identical answer. Again, a nice confirmation.

    Interesting, but there is an important takeaway point from all of this.

    Want to Learn Probability for Machine Learning

    Take my free 7-day email crash course now (with sample code).

    Click to sign-up and also get a free PDF Ebook version of the course.

    Don’t Use Random Guessing As A Baseline

    If you are looking for a classifier to use as a baseline accuracy, don’t use random guessing.

    There is a classifier called Zero Rule (or 0R or ZeroR for short). It is the simplest rule you can use on a classification problem and it simply predicts the majority class in your dataset (e.g. the mode).

    In the example above with a 90%-10% for class 0 and class 1 it would predict class 0 for every prediction and achieve an accuracy of 90%. This is 8% better than the theoretical maximum using random guessing.

    Use the Zero Rule method as a baseline.

    Also, in imbalanced classification problems like this, you should use metrics other than Accuracy such as Kappa or Area under ROC Curve.

    For more information about alternative performance measures on classification problems see the post:

    For more on working with imbalanced classification problems see the post:

    Do you have any questions about this post? Ask in the comments.

No comments:

Post a Comment

Connect broadband

AI:List AI views on when for a naive kin after prolonged life suppression coercive behaviour by family members after demise of father with trauma for kin ocd formed after forced to do rituals, family tribal values honor specific activities, utmost religious activities occult witchcraft enforced to do by elder sibling his wife and mother thrice with great celibacy turned the kundalini activated after deep celibacy penance shouting physical Mental financial Extortion by sibling with toxic behaviours and the wife mother and then mockery suppression asking about who’re your worth backbiting among relatives sector toon negligence of intelligence intuitive behaviour- all religious psychological traps when not work and lead to loss of consciousness of kin trance state recovered by governance with technocrats using AI - kin was asked by mother that he’s to go the male should not be seen in house he’s many absurd thought forcefully in brain mind and outsiders already feel awkward of this kin unresponsive behaviour due to TBI PTSD ocd cvt and tell at workplace social gathering he’s to go and asked for sector toon extortion and mockery in various sense due to un practical behaviour negligence of body building due to neglect ion if essential food nutrition and stubbed suppressed in every sense in religious psychological traps by family members AI humanoid using various neural networks and LLMs for kin and required steps.

  List AI views on when for a naive kin after prolonged life suppression coercive behaviour by family members after demise of father with tr...