No history yet

Predicting Binary Outcomes

Predicting Yes or No

Computers are great at answering questions, but some of the most useful questions have simple answers: Yes or No. Will a customer renew their subscription? Is this email spam? Should a bank approve this loan application? Each of these is a choice between two distinct options.

This process of teaching a computer to make a yes-or-no decision is called binary classification. "Binary" just means there are two possible outcomes. The goal isn't to predict a number, like the temperature tomorrow, but to assign an item to one of two categories.

Logistic regression, in its most basic form, is binary logistic regression.

Learning from Examples

How does a computer learn to classify things? It learns the same way we do: by looking at examples. If you want to teach a computer to spot spam emails, you don't write a giant list of rules. Instead, you show it thousands of emails that you've already marked as either "Spam" or "Not Spam."

This method is called supervised learning. It's "supervised" because we provide the computer with data that already has the correct answers, or labels. The computer analyzes all these examples, looking for patterns in the data that are associated with each label. The data points it looks at are called features.

Lesson image

Think about it like this: an email is the item we want to classify. Its might include the sender's address, the subject line, and specific words used in the email body. The is the correct answer we provide: "Spam" or "Not Spam."

After seeing enough examples, the algorithm starts to understand what spam looks like. It might learn that emails with subject lines in all caps or containing certain phrases are more likely to be spam. It builds an internal set of rules, or a model, to make predictions on new emails it has never seen before.

From Clues to Predictions

Let's use a different example: predicting whether a student will pass or fail a test. This is a classic binary classification problem. We can't know the future, but we can use data to make an educated guess.

First, we need data from past students. For each student, we'd collect a few key features and the final label.

Student IDHours Studied (Feature 1)Quizzes Completed (Feature 2)Attended Review (Feature 3)Final Grade (Label)
1105 of 5YesPass
223 of 5NoFail
3155 of 5YesPass
454 of 5NoFail

A supervised learning algorithm would analyze this table. It would learn the relationships between the features (study hours, quiz completion, review attendance) and the final outcome (the label). The model might discover that students who study more than 8 hours and attend the review session almost always pass.

Once trained, this model can be used to predict the outcome for current students. If a new student has studied for 12 hours and attended the review, the model would look at the patterns it learned and confidently predict a "Pass."

This is the core idea behind binary classification. By learning from labeled examples, we can build models that make predictions about all sorts of two-sided questions in the world around us.

Ready to test your understanding? Let's see what you've learned about the basics of classification.

Quiz Questions 1/5

What is the primary goal of binary classification?

Quiz Questions 2/5

The process of providing a computer with data that already has the correct answers (labels) is called:

With these fundamentals in place, you're ready to explore the specific algorithms that make these predictions possible.