Lesson 21 — Logistic prediction
Logistic regression: score, probability, class
Logistic regression is the classic yes/no model. Step 1: a score z = dot product of weights and features, plus a bias. Step 2: sigmoid(z) turns the score into a probability. Step 3: compare with a threshold (0.5) to choose the class.
score = sum(c * v for c, v in zip(coefs, values)) + offset
Each weight says how much a feature pushes towards "yes" (positive) or "no" (negative).
Why it matters: this three-step recipe is exactly what the last layer of most neural networks does for classification.
Compute z as the weighted sum of features plus bias. The program prints the probability and class for each email.
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.
Ready for more? Optional paid resources that pick up where this lesson leaves off.
Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.
Project-based AI / ML Foundations courses if you want a structured paid path after the free lessons. Wait for a sale — prices drop often.
Browse on Udemy →Search Amazon for AI / ML Foundations books — check the publication year so the examples match current versions.
Search Amazon →