โšกFREE Live Master Session: Code Your AI Companion for Kids

    Register for Free โ†’
    AI & ML WorksheetsModel Accuracy & Predictions
    Free Interactive Worksheet ยท Beginner

    Model Accuracy & PredictionsConfusion Matrix & Evaluation

    Learn how to calculate AI model accuracy, build confusion matrices (TP, TN, FP, FN), and evaluate predictions interactively!

    ๐ŸŽฏ

    Overview

    How do we measure AI success?

    After training a Machine Learning model, we measure its real-world performance. The simplest and most common evaluation metric is Accuracy โ€” the percentage of predictions the model got right out of total attempts.

    The Accuracy Formula
    Accuracy = (Correct Predictions / Total Predictions) ร— 100%

    ๐Ÿงฎ Interactive Accuracy Calculator

    Adjust the total and correct predictions below to see how accuracy updates live:

    Calculated Model Accuracy:18 / 20 = 90%
    ๐Ÿ“Š

    Accuracy Explained

    Spam Filter Case Study

    Imagine an AI spam filter tested on 20 new emails. It correctly flags 18 emails and makes 2 errors.

    Notice: Accuracy measures overall correctness, but doesn't tell us WHICH types of errors were made (e.g. did it miss spam, or delete your boss's important email?).

    โ“ Quick Practice: If a model correctly predicts 18 out of 20 emails, what is its accuracy?

    ๐Ÿงฉ

    Confusion Matrix

    Breaking Down the 4 Outcomes

    To see exactly where predictions go right or wrong, we build a Confusion Matrix with 4 quadrants:

    True Positive (TP) โœ…

    Spam email correctly identified and moved to Spam folder.

    True Negative (TN) โœ…

    Real email correctly sent to your Inbox.

    False Positive (FP) โŒ (False Alarm)

    Real important email falsely marked as Spam!

    False Negative (FN) โŒ (Missed Spam)

    Spam email falsely predicted as safe, slipping into Inbox.

    Predicted: SPAMPredicted: NOT SPAM
    Actual: SPAMTrue Positive (TP)
    Spam caught!
    False Negative (FN)
    Spam missed!
    Actual: NOT SPAMFalse Positive (FP)
    Real email blocked!
    True Negative (TN)
    Real email safe!
    ๐ŸŽฎ

    Playground: Confusion Matrix Builder

    Classify & Track Live Predictions

    Classify each email below as Spam or Not Spam to see the 2x2 confusion matrix and accuracy update live!

    "Win a free $1000 gift card now!"

    Actual: Spam

    "Team meeting tomorrow at 3 PM"

    Actual: Not Spam

    "URGENT: Your bank account is suspended!"

    Actual: Spam

    "Dinner with family this weekend?"

    Actual: Not Spam

    "Click here for cheap medicine deals"

    Actual: Spam

    "Invoice for your recent book order"

    Actual: Not Spam

    "CONGRATULATIONS you have been selected!"

    Actual: Spam

    "Project status report update"

    Actual: Not Spam

    "Double your savings fast"

    Actual: Spam

    "Can you review this code snippet?"

    Actual: Not Spam

    Live Confusion Matrix

    True Positive (TP)0
    False Negative (FN)0
    False Positive (FP)0
    True Negative (TN)0
    CURRENT ACCURACY0%0 / 0 Correct (0/10 Classified)
    Round 1 Score: 0%Round 2 Score: 0%
    ๐Ÿ’ช

    Interactive Exercises

    Total XP Earned: 0 / 90 XP
    0 / 4 Completed
    1

    Exercise 1: Calculate Accuracy

    +15 XP ยท Beginner
    2

    Exercise 2: Identify Error Type 1

    +20 XP ยท Intermediate
    3

    Exercise 3: Identify Error Type 2

    +25 XP ยท Intermediate
    3

    Exercise 4: The Accuracy Illusion

    +30 XP ยท Intermediate
    ๐Ÿง 

    Knowledge Check

    Ready to test your knowledge?

    Answer 10 multiple-choice questions to test your understanding of model accuracy and confusion matrices!

    ๐Ÿš€ Ready for live coding?

    Build Real Machine Learning Models with Tutors

    Take the next step! Join our live Intro to Machine Learning Course and write real Python ML code with expert 1-on-1 guidance.