Previously, in our first episode of Supervised Learning’s Got Talent, we were introduced to our debut performer, Linear Regression.

Linear Regression is the impressively correct oversimplifier. Today, however, we take a look at Mr. Linear’s quirky cousin. (Yes, they’re relatives!)

Introducing, Logistic Regression!

Logistic Regression: The Probability Bouncer. He either lets you in or out.

This guy’s specialty isn’t with drawing lines like Linear Regression, but he’s really good at making decisions.

Let’s get into it.

πŸ“ˆ Logistic Regression - β€œThe Probability Bouncer”

Now despite having β€œRegression” in its name (it’s a bit of a mathematical inside joke, really), this algorithm is actually a master of classification.

Specifically, he’s good at deciding Yes or No on something. Gotta appreciate that type of straightforwardness.

Logistic Regression isn’t trying to predict a continuous number like Linear Regression. Instead, it’s the ultimate yes/no or (0/1) question asker.

Can you think of someone you know who’s good at making decisions? Perhaps they’re good at answering questions like:

  • β€œWill this email be spam?”

  • β€œShould I post this selfie?”

  • β€œIs The Gradient Descent awesome?” (hint: YES).

Well, if you could magically transform that person into an ML algorithm they’d turn into Logistic Regression.

πŸ€– The Sigmoid Function

Logistic Regression works its magic by drawing an S-shaped curve instead of a straight line. This is called the Sigmoid Function.

For example, imagine we’re trying to decide if someone is on diet based on how many donuts they eat per day.

When that person eats fewer donuts, the chance of a diet is high. If they eat lots of donuts, that chance drop precipitously.

The Sigmoid Function to make that decision would look something like this:

Donuts vs Discipline: An Epic Battle.

Notice how those purple x’s are either on 0 or 1? That’s basically saying, yes this person is on a diet and deserves a pat on the back (0), or no this person’s not on a diet and deserves a pat on the stomach (1).

The smooth orange S-shaped curve is the sigmoid curve. See how it starts to curve upwards as more donuts are eaten? That’s basically showing the increasing probability that this person is not dieting.

Threshold

So how does Logistic Regression actually make the decision to say β€œyes” or β€œno” to something? It uses the Threshold.

The threshold is the cutoff point we set to decide when a probability flips from β€œNo” to β€œYes”.

By default (as you can see in the graph above), the threshold is usually 0.5:

  • If the model’s prediction is greater than or equal to 0.5, we say β€œYes”.

  • If the model’s prediction is less than 0.5, we say β€œNo”.

This is where the β€˜S’ formation comes from; the line starts to curve up as the threshold gets closer to 1.

The cool part? You can change the threshold depending on your problem. For example, you may want to lower the threshold to catch more spam emails, or for medical tests, you might raise it to be extra sure before saying someone has a disease.

🧠 The Math Of Sigmoid Function

With a name like β€œSigmoid Function”, of course there has to be math involved right? Don’t worry, the equation looks friendly. Let’s break it down:

The Sigmoid: Squishing inputs into a nice 'maybe'!

Οƒ(x) (sigma of x): This is the output of the function, and it will always be a value between 0 and 1. This is your probability!

e: This is Euler's number, an important mathematical constant, approximately 2.71828. It's the base of the natural logarithm.

x: This means you take your input value x and make it negative.

πŸ‘‰ When x is big ➜ Οƒ(x) gets close to 1 (a strong β€œYES”).
πŸ‘‰ When x is small (or negative) ➜ Οƒ(x) drops close to 0 (a strong β€œNO”).
πŸ‘‰ When x is around zero ➜ Οƒ(x) hovers near 50% (it could go either way).

Think of the sigmoid like a soft yes/no switch - not a hard cutoff. It smoothly shifts from β€œprobably no” to β€œprobably yes” as the input changes.

πŸ‘¨β€πŸ’» Coding Exercise + Practice Quiz + Visual PDF

Time to go from regression to progression with actual practice.

πŸ§ͺ Interactive Google Colab: See machine learning concepts in action with a simple hands-on demo using real data. Watch how models learn, improve, and sometimes completely overthink things. No experience needed β€” just hit run and explore.

πŸ“ Practice Quiz: 3 levels. 10 questions each. Easy covers the core concepts. Medium starts connecting ideas. Hard dives into the trickier topics that make even experienced people pause and go, β€œwait… hold on.”

πŸ“• Visual Cheatsheet: A clean visual guide to the key concepts from today’s lesson β€” organized, color-coded, and designed to be the reference you actually come back to when your brain decides to factory reset mid-study session.

logo

Alright, you made it this far… respect 🀝

Want to unlock the rest? Join the Pro Tier and get the good stuff. In other words, the stuff I didn't gatekeep. 😊 This paid tier is brand new, which means you have a chance to be one of the first people in.

Upgrade

What you unlock:

  • ⚑ Founding Member Deal: First 100 subscribers lock in $5/month for life. After that, it's $9.99/month
  • Cheat Sheets / Visual Guides (Weekly)
  • 10-Question Quiz (Easy / Medium / Hard) + Solutions (Weekly)
  • Hands-On Notebook: Google Colab Link + Jupyter Notebook For Coding Implementation (Weekly)
  • Discount Codes For All E-Books

Reply

Avatar

or to participate

Keep Reading