• About
  • Advertise
  • Privacy & Policy
  • Contact
Wednesday, December 31, 2025
  • Login
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
    • Home – Layout 4
    • Home – Layout 5
    • Home – Layout 6
  • News
    • All
    • Business
    • Politics
    • Science
    • World
    Hillary Clinton in white pantsuit for Trump inauguration

    Hillary Clinton in white pantsuit for Trump inauguration

    Amazon has 143 billion reasons to keep adding more perks to Prime

    Amazon has 143 billion reasons to keep adding more perks to Prime

    Shooting More than 40 Years of New York’s Halloween Parade

    Shooting More than 40 Years of New York’s Halloween Parade

    These Are the 5 Big Tech Stories to Watch in 2017

    These Are the 5 Big Tech Stories to Watch in 2017

    Why Millennials Need to Save Twice as Much as Boomers Did

    Why Millennials Need to Save Twice as Much as Boomers Did

    Doctors take inspiration from online dating to build organ transplant AI

    Doctors take inspiration from online dating to build organ transplant AI

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Tech
    • All
    • Apps
    • Gadget
    • Mobile
    • Startup
    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    Shadow Tactics: Blades of the Shogun Review

    Shadow Tactics: Blades of the Shogun Review

    macOS Sierra review: Mac users get a modest update this year

    macOS Sierra review: Mac users get a modest update this year

    Hands on: Samsung Galaxy A5 2017 review

    Hands on: Samsung Galaxy A5 2017 review

    The Last Guardian Playstation 4 Game review

    The Last Guardian Playstation 4 Game review

    These Are the 5 Big Tech Stories to Watch in 2017

    These Are the 5 Big Tech Stories to Watch in 2017

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
  • Entertainment
    • All
    • Gaming
    • Movie
    • Music
    • Sports
    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    macOS Sierra review: Mac users get a modest update this year

    macOS Sierra review: Mac users get a modest update this year

    Hands on: Samsung Galaxy A5 2017 review

    Hands on: Samsung Galaxy A5 2017 review

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Harnessing the power of VR with Power Rangers and Snapdragon 835

    Harnessing the power of VR with Power Rangers and Snapdragon 835

    So you want to be a startup investor? Here are things you should know

    So you want to be a startup investor? Here are things you should know

  • Lifestyle
    • All
    • Fashion
    • Food
    • Health
    • Travel
    Shooting More than 40 Years of New York’s Halloween Parade

    Shooting More than 40 Years of New York’s Halloween Parade

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Why Millennials Need to Save Twice as Much as Boomers Did

    Why Millennials Need to Save Twice as Much as Boomers Did

    Doctors take inspiration from online dating to build organ transplant AI

    Doctors take inspiration from online dating to build organ transplant AI

    How couples can solve lighting disagreements for good

    How couples can solve lighting disagreements for good

    Ducati launch: Lorenzo and Dovizioso’s Desmosedici

    Ducati launch: Lorenzo and Dovizioso’s Desmosedici

    Trending Tags

    • Golden Globes
    • Game of Thrones
    • MotoGP 2017
    • eSports
    • Fashion Week
  • Review
    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    Shadow Tactics: Blades of the Shogun Review

    Shadow Tactics: Blades of the Shogun Review

    macOS Sierra review: Mac users get a modest update this year

    macOS Sierra review: Mac users get a modest update this year

    Hands on: Samsung Galaxy A5 2017 review

    Hands on: Samsung Galaxy A5 2017 review

    The Last Guardian Playstation 4 Game review

    The Last Guardian Playstation 4 Game review

    Intel Core i7-7700K ‘Kaby Lake’ review

    Intel Core i7-7700K ‘Kaby Lake’ review

No Result
View All Result
Ai News
Advertisement
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
    • Home – Layout 4
    • Home – Layout 5
    • Home – Layout 6
  • News
    • All
    • Business
    • Politics
    • Science
    • World
    Hillary Clinton in white pantsuit for Trump inauguration

    Hillary Clinton in white pantsuit for Trump inauguration

    Amazon has 143 billion reasons to keep adding more perks to Prime

    Amazon has 143 billion reasons to keep adding more perks to Prime

    Shooting More than 40 Years of New York’s Halloween Parade

    Shooting More than 40 Years of New York’s Halloween Parade

    These Are the 5 Big Tech Stories to Watch in 2017

    These Are the 5 Big Tech Stories to Watch in 2017

    Why Millennials Need to Save Twice as Much as Boomers Did

    Why Millennials Need to Save Twice as Much as Boomers Did

    Doctors take inspiration from online dating to build organ transplant AI

    Doctors take inspiration from online dating to build organ transplant AI

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Tech
    • All
    • Apps
    • Gadget
    • Mobile
    • Startup
    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    Shadow Tactics: Blades of the Shogun Review

    Shadow Tactics: Blades of the Shogun Review

    macOS Sierra review: Mac users get a modest update this year

    macOS Sierra review: Mac users get a modest update this year

    Hands on: Samsung Galaxy A5 2017 review

    Hands on: Samsung Galaxy A5 2017 review

    The Last Guardian Playstation 4 Game review

    The Last Guardian Playstation 4 Game review

    These Are the 5 Big Tech Stories to Watch in 2017

    These Are the 5 Big Tech Stories to Watch in 2017

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
  • Entertainment
    • All
    • Gaming
    • Movie
    • Music
    • Sports
    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    macOS Sierra review: Mac users get a modest update this year

    macOS Sierra review: Mac users get a modest update this year

    Hands on: Samsung Galaxy A5 2017 review

    Hands on: Samsung Galaxy A5 2017 review

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Harnessing the power of VR with Power Rangers and Snapdragon 835

    Harnessing the power of VR with Power Rangers and Snapdragon 835

    So you want to be a startup investor? Here are things you should know

    So you want to be a startup investor? Here are things you should know

  • Lifestyle
    • All
    • Fashion
    • Food
    • Health
    • Travel
    Shooting More than 40 Years of New York’s Halloween Parade

    Shooting More than 40 Years of New York’s Halloween Parade

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Heroes of the Storm Global Championship 2017 starts tomorrow, here’s what you need to know

    Why Millennials Need to Save Twice as Much as Boomers Did

    Why Millennials Need to Save Twice as Much as Boomers Did

    Doctors take inspiration from online dating to build organ transplant AI

    Doctors take inspiration from online dating to build organ transplant AI

    How couples can solve lighting disagreements for good

    How couples can solve lighting disagreements for good

    Ducati launch: Lorenzo and Dovizioso’s Desmosedici

    Ducati launch: Lorenzo and Dovizioso’s Desmosedici

    Trending Tags

    • Golden Globes
    • Game of Thrones
    • MotoGP 2017
    • eSports
    • Fashion Week
  • Review
    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    The Legend of Zelda: Breath of the Wild gameplay on the Nintendo Switch

    Shadow Tactics: Blades of the Shogun Review

    Shadow Tactics: Blades of the Shogun Review

    macOS Sierra review: Mac users get a modest update this year

    macOS Sierra review: Mac users get a modest update this year

    Hands on: Samsung Galaxy A5 2017 review

    Hands on: Samsung Galaxy A5 2017 review

    The Last Guardian Playstation 4 Game review

    The Last Guardian Playstation 4 Game review

    Intel Core i7-7700K ‘Kaby Lake’ review

    Intel Core i7-7700K ‘Kaby Lake’ review

No Result
View All Result
Ai News
No Result
View All Result
Home Machine Learning

The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel

AiNEWS2025 by AiNEWS2025
2025-12-31
in Machine Learning
0
The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter


, we will implement AUC in Excel.

AUC is usually used for classification tasks as a performance metric.

But we start with a confusion matrix, because that is where everyone begins in practice. Then we will see why a single confusion matrix is not enough.

And we will also answer these questions:

  • AUC means Area Under the Curve, but under which curve?
  • Where does that curve come from?
  • Why is the area meaningful?
  • Is AUC a probability? (Yes, it has a probabilistic interpretation)

1. Why a confusion matrix is not enough

1.1 Scores from models

A classifier will usually give us scores, not final decisions. The decision comes later, when we choose a threshold.

If you read the previous “Advent Calendar” articles, you have already seen that “score” can mean different things depending on the model family:

  • Distance-based models (such as k-NN) often compute the proportion of neighbors for a given class (or a distance-based confidence), which becomes a score.
  • Density-based models compute a likelihood under each class, then normalize to get a final (posterior) probability.
  • Classification Tree-based models often output the proportion of a given class among the training samples inside the leaf (that is why many points share the same score).
  • Weight-based models (linear models, kernels, neural networks) compute a weighted sum or a non-linear score, and sometimes apply a calibration step (sigmoid, softmax, Platt scaling, etc.) to map it to a probability.

So no matter the approach, we end up with the same situation: a score per observation.

Then, in practice, we pick a threshold, often 0.5, and we convert scores into predicted classes.

And this is exactly where the confusion matrix enters the story.

1.2 The confusion matrix at one threshold

Once a threshold is chosen, every observation becomes a binary decision:

  • predicted positive (1) or predicted negative (0)

From that, we can count four numbers:

  • TP (True Positives): predicted 1 and actually 1
  • TN (True Negatives): predicted 0 and actually 0
  • FP (False Positives): predicted 1 but actually 0
  • FN (False Negatives): predicted 0 but actually 1

This 2×2 counting table is the confusion matrix.

Then we typically compute ratios such as:

  • Precision = TP / (TP + FP)
  • Recall (TPR) = TP / (TP + FN)
  • Specificity = TN / (TN + FP)
  • FPR = FP / (FP + TN)
  • Accuracy = (TP + TN) / Total

So far, everything is clean and intuitive.

But there is a hidden limitation: all these values depend on the threshold. So the confusion matrix evaluates the model at one operating point, not the model itself.

Confusion matrix – image by author

1.3 When one threshold breaks everything

This is a strange example, but it still makes the point very clearly.

Imagine that your threshold is set to 0.50, and all scores are below 0.50.

Then the classifier predicts:

  • Predicted Positive: none
  • Predicted Negative: everyone

So you get:

  • TP = 0, FP = 0
  • FN = 10, TN = 10
Confusion matrix with all scores below 0.5 – image by author

This is a perfectly valid confusion matrix. It also creates a very strange feeling:

  • Precision becomes #DIV/0! because there are no predicted positives.
  • Recall is 0% because you did not capture any positive.
  • Accuracy is 50%, which sounds “not too bad”, even though the model found nothing.

Nothing is wrong with the confusion matrix. The issue is the question we asked it to answer.

A confusion matrix answers: “How good is the model at this specific threshold?”

If the threshold is poorly chosen, the confusion matrix can make a model look useless, even when the scores contain real separation.

And in your table, the separation is visible: positives often have scores around 0.49, negatives are more around 0.20 or 0.10. The model is not random. Your threshold is simply too strict.

That is why a single threshold is not enough.

What we need instead is a way to evaluate the model across thresholds, not at a single one.

2. ROC

First we have to build the curve, since AUC stands for Area Under a Curve, so we have to understand this curve.

2.1 What ROC means (and what it is)

Because the first question everyone should ask is: AUC under which curve?

The answer is:

AUC is the area under the ROC curve.

But this raises another question.

What is the ROC curve, and where does it come from?

ROC stands for Receiver Operating Characteristic. The name is historical (early signal detection), but the idea is modern and simple: it describes what happens when you change the decision threshold.

The ROC curve is a plot with:

  • x-axis: FPR (False Positive Rate)
    FPR = FP / (FP + TN)
  • y-axis: TPR (True Positive Rate), also called Recall or Sensitivity
    TPR = TP / (TP + FN)

Each threshold gives one point (FPR, TPR). When you connect all points, you get the ROC curve.

At this stage, one detail matters: the ROC curve is not directly observed; it is constructed by sweeping the threshold over the score ordering.

2.2 Building the ROC curve from scores

For each score, we can use it as a threshold (and of course, we could also define customized thresholds).

For each threshold:

  • we compute TP, FP, FN, TN from the confusion matrix
  • then we calculate FPR and TPR

So the ROC curve is simply the collection of all these (FPR, TPR) pairs, ordered from strict thresholds to permissive thresholds.

This is exactly what we will implement in Excel.

ROC from scores – image by author

At this point, it is important to notice something that feels almost too simple. When we build the ROC curve, the actual numeric values of the scores do not matter. What matters is the order.

If one model outputs scores between 0 and 1, another outputs scores between -12 and +5, and a third outputs only two distinct values, ROC works the same way. As long as higher scores tend to correspond to the positive class, the threshold sweep will create the same sequence of decisions.

That is why the first step in Excel is always the same: sort by score from highest to lowest. Once the rows are in the right order, the rest is just counting.

2.3 Reading the ROC curve

In the Excel sheet, the construction becomes very concrete.

You sort observations by Score, from highest to lowest. Then you walk down the list. At each row, you act as if the threshold is set to that score, meaning: everything above is predicted positive.

That lets Excel compute cumulative counts:

  • how many positives you have accepted so far
  • how many negatives you have accepted so far

From these cumulative counts and the dataset totals, we compute TPR and FPR.

Now every row is one ROC point.

Why the ROC curve looks like a staircase

  • When the next accepted row is a positive, TP increases, so TPR increases while FPR stays flat.
  • When the next accepted row is a negative, FP increases, so FPR increases while TPR stays flat.

That is why, with real finite data, the ROC curve is a staircase. Excel makes this visible.

2.4 Reference cases you should recognize

A few reference cases help you read the curve immediately:

  • Perfect classification: the curve goes straight up (TPR reaches 1 while FPR stays 0), then goes right at the top.
Perfect classification ROC – image by author
  • Random classifier: the curve stays close to the diagonal line from (0,0) to (1,1).
Random classification ROC – image by author
  • Inverted ranking: the curve falls “below” the diagonal, and the AUC becomes smaller than 0.5. But in this case we have to change the scores with 1-score. In theory, we can consider this fictive case. In practice, this usually happens when scores are interpreted in the wrong direction or class labels are swapped.
Inverted ranking ROC – image by author

These are not just theory. They are visual anchors. Once you have them, you can interpret any real ROC curve quickly.

3. ROC AUC

Now, with the curve, what can we do?

3.1 Computing the area

Once the ROC curve exists as a list of points (FPR, TPR), the AUC is pure geometry.

Between two consecutive points, the area added is the area of a trapezoid:

  • width = change in FPR
  • height = average TPR of the two points

In Excel, this becomes a “delta column” approach:

  • compute dFPR between consecutive rows
  • multiply by the average TPR
  • sum everything
ROC AUC in excel – image by author

Different cases:

  • perfect classification: AUC = 1
  • random ranking: AUC ≈ 0.5
  • inverted ranking: AUC

So the AUC is literally the summary of the whole ROC staircase.

3.2. AUC as a probability

AUC is not about choosing a threshold.

It answers a much simpler question:

If I randomly pick one positive example and one negative example, what is the probability that the model assigns a higher score to the positive one?

That is all.

  • AUC = 1.0 means perfect ranking (the positive always gets a higher score)
  • AUC = 0.5 means random ranking (it is basically a coin flip)

This interpretation is extremely useful, because it explains again this important point:

AUC only depends on score ordering, not on the absolute values.

This is why ROC AUC works even when the “scores” are not perfectly calibrated probabilities. They can be raw scores, margins, leaf proportions, or any monotonic confidence value. As long as higher means “more likely positive”, AUC can evaluate the ranking quality.

Conclusion

A confusion matrix evaluates a model at one threshold, but classifiers produce scores, not decisions.
ROC and AUC evaluate the model across all thresholds by focusing on ranking, not calibration.

In the end, AUC answers a simple question: how often does a positive example receive a higher score than a negative one?
Seen this way, ROC AUC is an intuitive metric, and a spreadsheet is enough to make every step explicit.

Source link

#Machine #Learning #Advent #Calendar #Bonus #AUC #Excel

Tags: Area Under The CurveConfusion Matrixdata sciencemachine learningStatistics
Previous Post

The science of how (and when) we decide to speak out—or self-censor

AiNEWS2025

AiNEWS2025

Stay Connected test

  • 23.9k Followers
  • 99 Subscribers
  • Trending
  • Comments
  • Latest
A tiny new open source AI model performs as well as powerful big ones

A tiny new open source AI model performs as well as powerful big ones

0
Water Cooler Small Talk: The Birthday Paradox 🎂🎉 | by Maria Mouschoutzi, PhD | Sep, 2024

Water Cooler Small Talk: The Birthday Paradox 🎂🎉 | by Maria Mouschoutzi, PhD | Sep, 2024

0
Ghost of Yōtei: The acclaimed Ghost of Tsushima is getting a sequel

Ghost of Yōtei: The acclaimed Ghost of Tsushima is getting a sequel

0
Best Headphones for Working Out (2024): Bose, Shokz, JLab

Best Headphones for Working Out (2024): Bose, Shokz, JLab

0
The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel

The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel

2025-12-31
The science of how (and when) we decide to speak out—or self-censor

The science of how (and when) we decide to speak out—or self-censor

2025-12-31
Two cybersecurity employees plead guilty to carrying out ransomware attacks

Two cybersecurity employees plead guilty to carrying out ransomware attacks

2025-12-31
Ship of Scientists Headed to Doomsday Glacier

Ship of Scientists Headed to Doomsday Glacier

2025-12-31

Recent News

The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel

The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel

2025-12-31
The science of how (and when) we decide to speak out—or self-censor

The science of how (and when) we decide to speak out—or self-censor

2025-12-31
Two cybersecurity employees plead guilty to carrying out ransomware attacks

Two cybersecurity employees plead guilty to carrying out ransomware attacks

2025-12-31
Ship of Scientists Headed to Doomsday Glacier

Ship of Scientists Headed to Doomsday Glacier

2025-12-31
Footer logo

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Follow Us

Browse by Category

  • AI & Cloud Computing
  • AI & Cybersecurity
  • AI & Sentiment Analysis
  • AI Applications
  • AI Ethics
  • AI Future Predictions
  • AI in Education
  • AI in Fintech
  • AI in Gaming
  • AI in Healthcare
  • AI in Startups
  • AI Innovations
  • AI News
  • AI Research
  • AI Tools & Automation
  • Apps
  • AR/VR & AI
  • Business
  • Deep Learning
  • Emerging Technologies
  • Entertainment
  • Fashion
  • Food
  • Gadget
  • Gaming
  • Health
  • Lifestyle
  • Machine Learning
  • Mobile
  • Movie
  • Music
  • News
  • Politics
  • Review
  • Robotics & Smart Systems
  • Science
  • Sports
  • Startup
  • Tech
  • Travel
  • World

Recent News

The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel

The Machine Learning “Advent Calendar” Bonus 1: AUC in Excel

2025-12-31
The science of how (and when) we decide to speak out—or self-censor

The science of how (and when) we decide to speak out—or self-censor

2025-12-31
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
No Result
View All Result

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.