Fundamental Machine Learning

Ch.6: Instance-Based vs. Model-Based Learning

By Ayush Arora5 min read

Inspired by: YouTube

In the previous posts, we categorized machine learning based on the amount of supervision required (Supervised vs. Unsupervised) and how the model updates in production (Batch vs. Online Learning). Today, we are looking at a third way to classify machine learning algorithms: How the model actually learns and generalizes from the data.

When human beings learn, we generally fall into one of two categories. Sometimes, we simply memorize or rote-learn the material because we just need to pass an exam. Other times, we focus on understanding the underlying concepts and principles (like deriving a physics equation).

Machine learning algorithms learn in the exact same two ways:

  1. Instance-Based Learning: Memorizing the data.
  2. Model-Based Learning: Understanding the underlying concepts to build a generalized rule.

The main goal of this post is not to dive deep into the complex mathematics of these algorithms, but to ensure that whenever you study a new algorithm in the future, you can instantly identify which of these two learning styles it uses.


Instance-Based Learning

Instance-Based Learning is the simplest form of machine learning. The core philosophy here is pure memorization.

The Placement Prediction Example

Imagine you have a dataset of college students with three columns:

If you plot this on a 2D graph, you might put IQ on the X-axis and CGPA on the Y-axis. You would have red dots representing students who got placed, and blue dots representing students who did not.

When you feed this training data into an Instance-Based algorithm, it does not try to find any complex mathematical patterns. It simply stores the entire dataset in its memory as-is. It essentially does nothing during the training phase.

How it Predicts

Now, a new student arrives. Their CGPA is 7.5 and their IQ is 103. You plot this new query point on the graph. How does the algorithm decide if this student will get placed?

Since the algorithm hasn't learned a "rule", it relies on a simple principle: Similarity. It calculates the physical distance between this new student and every other student in its stored memory. It then looks at the closest neighbors.

If you tell the algorithm to look at the 3 nearest neighbors, and 2 out of those 3 neighbors are red dots (placed), the algorithm will predict that this new student will also get placed.

This specific logic is the foundation of the K-Nearest Neighbors (KNN) algorithm.

The "Lazy Learner"

Because the model just sits quietly and stores data without actually doing any computational learning upfront, Instance-Based algorithms are often called "Lazy Learners". They only wake up and do the heavy lifting (calculating distances) when you explicitly ask them to make a prediction on a new point.


Model-Based Learning

Model-Based Learning takes the opposite approach. It wants to find the underlying principle in the data.

Using the exact same IQ and CGPA placement dataset, a Model-Based algorithm will look at all the red and blue dots and attempt to draw a Decision Boundary (a mathematical line or curve) that separates the placed students from the unplaced students.

This boundary is the "Model". It is represented by a mathematical equation defined by a set of parameters (like slopes, intercepts, or weights).

How it Predicts

The biggest advantage of this approach happens after the training phase is complete. Once the algorithm has successfully figured out the mathematical equation for the decision boundary, it no longer needs the training data. You can completely delete the original dataset.

When the new student (CGPA 7.5, IQ 103) arrives, the algorithm simply plugs those numbers into its mathematical equation. If the result falls on the left side of the boundary, they get placed. If it falls on the right, they don't.

Most of the popular machine learning algorithms you will encounter are Model-Based. Examples include:


Key Differences Summary

Here is a breakdown of how the two approaches compare across critical technical dimensions:

1. Data Preparation

Both approaches require the exact same amount of initial data preprocessing. You must handle missing values, remove outliers, and encode strings into numbers regardless of the learning style.

2. Model Generation

3. Training Phase

4. Storage Requirements