Skip to content
COURSE TOPIC

Supervised Machine Learning: Regression and Classification

Understand labeled data, features and targets, simple baselines, and the difference between regression and classification.

Part of course Data Science & Machine Learning Course
Difficulty Level
Intermediate
Estimated Learning Time
90-120 minutes
OVERVIEW

About Supervised Machine Learning: Regression and Classification

Supervised learning uses examples with known outcomes to fit a model that predicts outcomes for new examples. The task definition and data quality matter as much as the algorithm.

LEARNING OUTCOMES

What You Will Learn

  • Distinguish regression from classification tasks.
  • Separate features and target without leaking future information.
  • Compare a model with a simple baseline.
TOPIC GUIDE

Learn Supervised Machine Learning: Regression and Classification

Define the prediction task

Specify the unit being predicted, the point in time the prediction is made, and the target. For example, predicting a numeric measurement differs from classifying one of a set of categories.

Build a baseline first

A simple baseline provides a reference for whether a more complex model adds value. Split training and evaluation data in a way that reflects how the model would be used; time-dependent problems may require time-based splits.

Fit and inspect a model

Scikit-learn estimators offer a consistent fit/predict workflow. Check feature types, missing data, and target definitions. Do not include a field that would only be known after the outcome or that directly reveals the answer.

Interpret predictions in context

Model output is not certainty. Review errors, class balance, and subgroup behavior where appropriate. A prediction should not be used for consequential decisions without domain expertise, safeguards, and a valid assessment of its intended use.

PRACTICAL EXAMPLE

Example / Code

Example
from sklearn.dummy import DummyClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report

X_train, X_test, y_train, y_test = train_test_split(
    features, target, test_size=0.2, random_state=42, stratify=target
)
baseline = DummyClassifier(strategy='most_frequent')
baseline.fit(X_train, y_train)
predictions = baseline.predict(X_test)
print(classification_report(y_test, predictions, zero_division=0))
TRY IT YOURSELF

Practice Task

Apply what you learned with a practical activity.

Choose a permitted educational dataset and define a regression or classification target. Fit a simple baseline, state how the data was split, and describe one way leakage could produce an overly optimistic score.

TOOLKIT

Tools & Technologies

  • Python
  • Pandas
  • scikit-learn
  • Jupyter
READY FOR THE COMPLETE COURSE?

Go Beyond Supervised Machine Learning: Regression and Classification

Explore the complete Data Science & Machine Learning Course curriculum, practical training, learning path and course details.