What is Machine Learning?

This is the introductory session: what the course will cover, what Machine Learning actually is, how it differs from traditional programming, when to use it, its history, and why ML jobs pay so well today.

โฑ๏ธ 12 min read ๐ŸŽฏ Beginner Friendly
On This Page
๐Ÿ“‹

1. About the Course

Note: Individual ML algorithms (Linear Regression, Decision Trees, etc.) are not taught in detail here โ€” those live in separate dedicated algorithm courses. This course is about the workflow, lifecycle, and deployment, not algorithm internals.
๐Ÿง 

2. What is Machine Learning?

Formal definition (Arthur Samuel): "Machine Learning is a field of computer science that uses statistical techniques to give computer systems the ability to 'learn' with data, without being explicitly programmed."

Simple version: ML is all about learning from data.

โš–๏ธ

3. Traditional Programming vs. Machine Learning

This is the core mental model for the whole topic.

Traditional Programming
๐Ÿ—„๏ธ
Data (Input)
e.g., numbers, text, user input
๐Ÿงพ
Program (Rules / Instructions)
e.g., code written by a human
โ†’
๐Ÿ–ฅ๏ธ
Computer
Executes instructions
โ†’
๐Ÿ“„
Output (Result)
e.g., calculation result, decision, report
In traditional programming, we give the data and explicit instructions (program) to the computer, and it produces the output.
Machine Learning
๐Ÿ—„๏ธ
Data (Input)
e.g., labeled examples, historical data
๐Ÿ“„
Output (Target / Labels)
e.g., correct answers, known results
โ†’
๐Ÿ–ฅ๏ธ
Computer
Learns patterns from data
โ†’
๐Ÿง 
Program (Learned Model)
e.g., model that can make predictions
In machine learning, we give the data and the correct outputs to the computer, and it learns a program (model) that can produce the right output for new data.

How to read this:

Key Differences

FeatureTraditional ProgrammingMachine Learning
Logic CreationWritten manually by developersGenerated automatically by the ML algorithm
ApproachExplicit rules for every scenarioPatterns discovered from historical input/output data
AdaptabilityBreaks when a new, unhandled scenario appearsAutomatically updates when new data is provided (via retraining)

Illustration: Addition Example

Traditional approach โ€” logic is hardcoded, so it only works for exactly the case you coded for:

Traditional Programming Approach

Logic is manually written (hardcoded) for a specific case

๐Ÿ Code (Manually written logic)
# Traditional Approach: Logic is manually
# hardcoded for exactly 2 numbers
def add_two_numbers(a, b):
    return a + b

print("Sum:", add_two_numbers(5, 10))
Input (2 numbers)
a = 5
b = 10
โ†’
Function
add_two_numbers(a, b)
Logic (hardcoded):
return a + b
โ†’
Output
Sum: 15

Problem: Fails for 3 numbers

The logic was not written to handle 3 numbers.

# This will fail because the function
# expects exactly 2 arguments
print(add_two_numbers(5, 10, 15))
Error
TypeError: add_two_numbers() takes 2 positional arguments but 3 were given
โ†’
!

The function was designed only for 2 numbers, so it fails when 3 numbers are provided.

๐Ÿ’ก

In traditional programming, we have to manually write the logic for each case.
If we want to handle a different scenario (like 3 numbers), we need to modify the code.

ML approach โ€” instead of writing the + logic, you give the model examples of inputs and their sums, and it learns the pattern:

Machine Learning Example: Linear Regression

Instead of writing the logic (like +), we give data and let the algorithm learn the pattern.

๐Ÿ Python Code (Using scikit-learn)
import numpy as np
from sklearn.linear_model import LinearRegression

# 1. Provide Training Data (Inputs and Outputs)
X_train = np.array([[1, 4], [5, 31], [6, 8], [8, 16], [28, 31]])
y_train = np.array([8, 26, 28, 31])

# 2. Instantiate the ML Algorithm
model = LinearRegression()

# 3. Fit (Train) โ€” the algorithm discovers
# the pattern on its own
model.fit(X_train, y_train)

# 4. Predict on brand-new inputs โ€” no explicit
# "+" logic written
X_new = np.array([[3, 10]])
predictions = model.predict(X_new)

print("Predictions for new data:", predictions)
1
Provide Training Data (Inputs and Outputs)
We give example data to the algorithm.
Input Features (X_train)
X1X2
14
531
68
816
2831
Target Output (y_train)
y
8
26
28
31
Each row is an example with 2 input features (X1, X2) and a target output (y).
2
Instantiate the ML Algorithm
We create a Linear Regression model.
model = LinearRegression()
3
Fit (Train) the Model
The algorithm automatically learns the pattern (relationship) between inputs and output from the training data.
model.fit(X_train, y_train)
๐Ÿ–ฅ๏ธ
The model learns the best-fitting line automatically. No explicit "+" logic is written.
4
Predict on New Data
We give new input and the trained model predicts the output.
X_new = np.array([[3, 10]])
predictions = model.predict(X_new)
โ†’
New Input
X1X2
310
โ†’
Predicted Output
Predictions: [ 15.72 ]
๐Ÿ’ก

Key Takeaway
In traditional programming, we write the exact logic. In machine learning, we provide data and let the algorithm learn the pattern to make predictions on new data.

What's happening, step by step:

  1. Data supply โ€” X_train (input pairs) and y_train (their known sums) are given to the model.
  2. Pattern discovery โ€” model.fit() tells the algorithm to find the mathematical relationship between inputs and outputs, without anyone writing +.
  3. Inference โ€” model.predict() runs the learned relationship on new, unseen inputs.
๐ŸŽฏ

4. When & Where to Use Machine Learning?

Three major scenarios where ML beats traditional software development:

๐Ÿง 

When to Use Machine Learning?

Use machine learning when it is difficult or impractical to write explicit rules, and you have data to learn from.

1
Frequently Changing Rules
When the rules keep changing and are hard to maintain manually.
Example: Spam Filter

Spam patterns keep evolving. Instead of writing new rules every time, a machine learning model learns from data and adapts automatically.

๐Ÿ“ง
โ†’โš ๏ธ Spam
โ†’โœ… Not Spam
2
Complex Rules / Image Classification
When the problem is too complex to write explicit rules.
Example: Image Classification

It's hard to write rules for all possible variations of a cat or dog. A machine learning model learns patterns from thousands of images.

๐Ÿฑ
โ†’
ML
Model
โ†’Cat
โ†’Dog
3
Data Mining & Hidden Insights
When you want to discover patterns, trends, or insights from large amounts of data.
Example: Customer Segmentation

Find hidden groups of customers, buying patterns, or trends in data that are not easily visible with simple rules.

ML helps uncover hidden patterns and valuable insights from data.
๐Ÿ’ก

Key Takeaway: Use machine learning when rules are dynamic, complex, or unknown, and you have enough data to learn from.

Scenario 1: Frequently Changing Rules โ€” Spam Filter Example

โš™๏ธ

Traditional Rule-Based Approach (Fragile)

Works only for specific keywords. If spammers reword their message, it can fail.

๐Ÿ Rule-Based Spam Filter (Python Code)
# Traditional Rule-Based Approach (Fragile)
def is_spam_rule_based(email_text):
    # List of predefined spam keywords
    spam_words = ["huge discount", "sale", "free money"]

    for word in spam_words:
        if word in email_text.lower():
            return "Spam"

    return "Not Spam"

# Test with a reworded spam message
print(is_spam_rule_based("Get a massive discount today!"))

# Returns "Not Spam" โ€” False Negative!
โœ“Example 1: Keyword Match (Detected)
โ†’
Result
Spam
(Keyword "huge discount" found)
โœ•Example 2: Reworded Message (Missed)
โ†’
Result
Not Spam
(No exact keyword match)
False Negative!
๐Ÿ’ก

Key Takeaway: Traditional rule-based systems are fragile because they rely on exact keywords or manually written rules. If spammers change their wording (e.g., "massive discount" instead of "huge discount"), the system can fail to detect spam.

This is why machine learning is often used โ€” it can learn patterns from data and handle new variations automatically.

Important point: hardcoded word lists need constant manual maintenance. ML instead learns feature weights from new training emails automatically โ€” no manual list-editing needed.

Scenario 2: Too Many Complex Rules โ€” Image Classification

Scenario 3: Data Mining & Hidden Patterns

๐Ÿ“œ

5. History & Evolution of Machine Learning

The "Nawazuddin Siddiqui" Analogy

ML's history is a bit like actor Nawazuddin Siddiqui, who played small, uncredited roles (e.g., in Munna Bhai M.B.B.S.) for years before becoming a major star. Similarly, ML theory existed quietly in the background for decades before suddenly becoming mainstream.

The Rise of Machine Learning: From Theory to Global Impact
1970s โ€“ 2000s
Theoretical foundations existed
๐Ÿ“š

Core ideas like neural networks, decision trees, SVMs, etc. were researched during this period.

๐Ÿค”

However, it remained a dormant / niche role, mostly in research academia.

Dormant / niche role
โžœ Advancements in data and hardware changed everything
Post-2010s
Data explosion + GPU hardware
๐Ÿ“„๐Ÿ–ผ๏ธโ–ถ๏ธ๐Ÿ’ฌ
โ†“
๐Ÿ—„๏ธ

Massive amounts of data from the internet, smartphones, social media, IoT, etc.

+
GPU

Powerful GPU hardware enabled training of large models on huge datasets.

Massive global industry
๐Ÿ“Š

Result: Machine learning evolved from a niche research topic to a massive global industry, powering real-world applications in every domain today.

Why Did ML Explode Post-2010?

  1. Massive data generation
    • Smartphones + internet access let billions of people generate data continuously.
    • Key fact: the amount of digital data created in 2016 alone surpassed all data generated in human history up to 2015.
  2. Hardware advancements
    • Earlier researchers were limited by memory/compute (even 128 MB RAM was "high-end" at the time).
    • Modern devices have multi-gigabyte RAM and powerful GPUs, enabling fast training on complex datasets.
Takeaway: ML theory was always there โ€” what changed was the availability of (a) huge amounts of data and (b) the hardware to process it.
๐Ÿ’ผ

6. Industry Demand & Why ML Salaries Are High

Simple Supply & Demand Logic

Future Outlook

๐Ÿ”‘

Things to Remember

๐Ÿ”‘ Key Takeaways
๐Ÿ“

Quick Revision

๐Ÿ“ 30-Second Recap

Machine Learning flips traditional programming on its head: instead of writing rules to turn data into output, you feed the computer data and known outputs, and it works out the rules itself (that's the "model"). It shines where rules change constantly (spam filters), where rules are too complex to hand-code (recognizing objects in images), or where you need to dig out patterns too subtle for a human to spot on a chart. ML's math has existed for decades, but it only exploded after 2010 once the world had enough data and GPU power to actually train on it โ€” and that same explosion in demand (with still-scarce ML talent) is why ML salaries are currently high.