Teach Your Model to Choose
Explore how classification models work to predict categories or labels instead of numeric values. Understand decision boundaries and build a K-nearest neighbors classifier using the iris flower dataset. Gain hands-on experience training, testing, and making predictions with classification models to better classify data into distinct groups.
We'll cover the following...
In the previous section, you used regression models to predict continuous values such as house prices or temperatures.
Now, we’ll shift to a different problem—classification—where the goal is to predict categories or labels instead of numeric values. For example, you might want to detect whether an email is spam or predict whether a customer will churn or stay. Classification models are designed for these tasks where the output falls into one of several predefined classes.
What is classification?
Classification is a machine learning task where the model learns to assign input data into one of several predefined categories or classes. Instead of forecasting a number, our model predicts a label or a group.
Classification analyzes input data and predicts which discrete category it belongs to. Think of it as teaching the model to sort items into distinct buckets. This relationship can be expressed in equation form as:
Here,