“MLshorts” 15: What is Supervised Machine Learning

A simple and clear explanation

Vasilis Kalyvas
Python’s Gurus
3 min readJun 15, 2024

--

Image created with Leonardo.Ai — A robot studying and learning at a library

What is Supervised ML? 🤔

Supervised learning is a type of Machine Learning (ML) where the model is trained on labeled data (learn more for ML here). This means that each training example is paired with an output label.

The goal is for the model to learn the relationship between the input data and the output labels so it can predict the output for new, unseen data accurately.

The model gets trained on training data, where every example (e.g. every row in a table) has a set of features as input and a label as a corresponding output. Features are the characteristics of an example, whereas label is the target we want to predict.

For example, when trying to predict the price of a car, the “features” will be its age, engine type, kilometers driven, model name etc and “label” is its price. When the model manages to identify patterns between the features and the price in the training, then it will be able to predict the price of a new car given its own features.

What are some Supervised learning algorithms? 📋

The most basic ones are:

  • Linear Regression: for predicting a continuous output variable
  • Logistic Regression: for binary classification problems
  • Decision Trees: for splitting the data into branches to make predictions, either for continuous or binary or milti-class variable
  • Support Vector Machines (SVM): mainly for classification tasks by finding the best boundary that separates different classes
  • Neural Networks: more complex models, used for a variety of tasks including image/sound recognition, natural language processing, time series forecasting and of course anything around Generative AI (the most fancy topic nowadays!)

How does a Supervised model actually “learn”? 📖

We tend to say this word without even thinking or understanding, but what “learning” actually means??

Does this model, this algorithm, even have a brain, eyes or ears? How does it learn, like a human?

Well, no (until now, of course!). “Learning” means that the model identifies patterns, correlations, and dependencies between features and labels and then uses these relationships to make predictions on new, unseen data.

It generally goes like this:

  1. The model is given training data, with their features and corresponding labels.
  2. It is also given some initial parameters (like weights, number of trees, number of leaves etc).
  3. It uses its initial parameters to make predictions on the training data.
  4. It evaluates the accuracy of its predictions by comparing them to the actual labels. This is done using a loss function, which quantifies the difference between predicted values and actual values (such as Mean Squared Error).
  5. It then adjusts the parameters to minimize the loss function. If it decreases the error, it actually means that the predictions are more accurate.
  6. It repeats the prediction and optimization again and again
  7. It stops the re-iterations when the loss function converges to a minimum value and no further improvement can be achieved. Now we can say that the model “learnt” the relationships in the data.

So, to make it clear, “learning” is:

  • Pattern Recognition
  • Parameter Adjustment
  • Re-iterations

Why is Supervised learning important? 💎

Supervised learning is a powerful tool in the Machine Learning toolkit, allowing models to make accurate predictions and classifications based on labeled data. It has the most various use cases, such as Time Series forecasting, price prediction, demand forecasting, email filtering, medical diagnosis, sentiment analysis, translation etc and, of course, needs well-labeled datasets to shine. It is one of the most fundamental concepts for someone who starts exploring the magnificent ML world.

Was this article valuable for you? Follow, subscribe, connect on LinkedIn/Kaggle and see you in my next “MLshorts” article! 👋

Python’s Gurus🚀

Thank you for being a part of the Python’s Gurus community!

Before you go:

  • Be sure to clap x50 time and follow the writer ️👏️️
  • Follow us: Newsletter
  • Do you aspire to become a Guru too? Submit your best article or draft to reach our audience.

--

--