Introduction to Machine Learning
Introduction to Machine Learning 1 / 27
Learning Outcomes
After completing this lecture, students will be able to:
Define Machine Learning (ML)
Understand real-world applications of ML
Differentiate Classification and Regression
Explain Learning Associations
Understand Unsupervised Learning
Explain Reinforcement Learning
Introduction to Machine Learning 2 / 27
What is Machine Learning?
Definition
Machine Learning (ML) is a branch of Artificial Intelligence (AI) that enables computers to
learn from data and improve their performance without being explicitly programmed.
Key Idea
Machine Learning uses data, algorithms, and experience to make predictions or decisions.
Goal:
Extract useful information from data
Build predictive models
Automate decision-making processes
Introduction to Machine Learning 3 / 27
Traditional Programming vs Machine Learning
In traditional programming, a programmer explicitly writes rules to solve a problem.
Input + Program → Output
Example:
Suppose we want to determine whether a student has passed an examination or not.
Input: Marks = 95
Program Rule: If marks > 50, then Pass
Output: Pass
The computer follows the predefined rules written by the programmer.
Introduction to Machine Learning 4 / 27
Traditional Programming vs Machine Learning
Machine Learning
In Machine Learning, instead of writing explicit rules, we provide examples (data) from which
the machine learns patterns automatically.
Model Training
Input Data + Output Data → Learning Algorithm → Model
Model Testing
New Input → Model → Prediction/Classification
Input Data Learning Algorithm Trained Model Prediction/Classification
Data + Learning Algorithm = Intelligent Model
Introduction to Machine Learning 5 / 27
Formal Definition of Machine Learning
Mitchell’s Definition of Machine Learning
A computer program is said to learn from Experience (E) with respect to some class of
Tasks (T) and Performance Measure (P), if its performance at tasks in T , as measured by
P, improves with experience E .
Experience Tasks Performance
(E) (T) Measure (P)
Examples
Experience (E): Training Data
Tasks (T): Classification, Prediction, Control
Performance (P): Accuracy, Error Rate, Reward
Introduction to Machine Learning 6 / 27
Frame Title
Example: Email Spam Detection
Term Meaning
Task (T) Classify emails as Spam or Not Spam
Experience (E) Previously labeled emails
Performance (P) Classification Accuracy
Training Examples
Email Label
Win $1000 Now! Spam
Meeting at 2 PM Not Spam
Claim Your Prize Spam
Project Report Attached Not Spam
Introduction to Machine Learning 7 / 27
Schematic Diagram of the ML Mode
Experience Problem
(Data) Task
Background
Knowledge Learner Model
(Domain Knowledge)
Reasoner
Answer
(Performance)
Introduction to Machine Learning 8 / 27
For Creating a Learner
1 Choose the training experience (data/features).
2 Choose the target function
(that is to be learned).
3 Choose how to represent the target function
(Linear or Non-linear representation).
Introduction to Machine Learning 9 / 27
Examples of Machine Learning Applications
Email Spam Detection Product Recommendation
Face Recognition Weather Forecasting
Medical Diagnosis Stock Prediction
Credit Card Fraud Detection Chatbots
Speech Recognition Image Classification
Autonomous Vehicles Machine Translation
ML is used whenever systems learn patterns from data.
Introduction to Machine Learning 10 / 27
Types of Machine Learning
Supervised Learning
Learning using labeled data
Training data consists of input-output pairs (X , Y ).
The learning algorithm learns a mapping:
f :X →Y
For a new input, the model predicts the corresponding output.
Training Data
(x1 , y1 ) Learning
(x2 , y2 ) Model New Input
Algorithm
..
.
Prediction or classi
Goal: Learn from labeled examples and predict outputs for unseen data.
Introduction to Machine Learning 11 / 27
Training Examples in Supervised Learning
Training Dataset
x1 x2 x3 ··· Y
Input1 a1 a2 a3 ··· y1
Input2 b1 b2 b3 ··· y2
Input3 c1 c2 c3 ··· y3
x1 , x2 , . . . , xn are called features (input attributes).
Y is the target attribute to be predicted.
Each row represents one training example.
For a new instance
(z1 , z2 , . . . , zn )
the model predicts the corresponding target value.
Introduction to Machine Learning 12 / 27
Target Feature in Supervised Learning
Target Feature (Y ) Classification Discrete Output
Regression Continuous Output
Classification
Output belongs to a finite set of classes.
Examples:
Rain / No Rain
Low-Risk / High-Risk
Spam / Not Spam
Regression
Output is a continuous numerical value.
Example:Price=f(Location,Floor Area,No. of BHKs)
Introduction to Machine Learning 13 / 27
Credit Scoring as a Classification Problem
Savings
Low-Risk
⊕
⊖ ⊕
⊕
⊖ ⊕ ⊕
θ2 High-Risk
⊖
⊖ ⊖
Income
θ1
A discriminant separates customers into Low-Risk and High-Risk groups.
Introduction to Machine Learning 14 / 27
Credit Scoring as a Classification Problem
Learned Classification Rule
IF Income > θ1 AND Savings > θ2
THEN Low-Risk ELSE High-Risk
This rule acts as a discriminant function that separates customers into Low-Risk and
High-Risk classes.
Introduction to Machine Learning 15 / 27
Regression in Supervised Learning
Regression Problem
The output variable is a continuous numerical value.
Example: Predicting the price of a used car.
Input attributes may include:
Mileage
Price
Regression Function
The goal is to learn a function that predicts the car price from its mileage:
y = wx + w0
where
w = slope (weight)
w0 = intercept (bias)
Introduction to Machine Learning 16 / 27
Price (y )
×
×
×
×
×
×
×
Mileage (x)
A fitted line is the line that best matches the training data and is used to make predictions for
new inputs.
Introduction to Machine Learning 17 / 27
Regression Model Learning
General Machine Learning Model
y = g (x | θ)
g (·) : model/function
θ : model parameters
Goal: Find parameters that minimize prediction error and start with random initial values.
Model Equ Parameters (θ)
Linear Regression y = wx + w0 {w , w0 }
Polynomial Regression y = w2 x 2 + w1 x + w0 {w2 , w1 , w0 }
Neural Network y = f (w 1x1 + w 2x2 + b) All weights and biases
The learning algorithm adjusts the parameters to obtain the best fit to the training data and accurately
predict the price of a new car.
Introduction to Machine Learning 18 / 27
Unsupervised Learning
Definition
Unsupervised learning works with unlabeled data and discovers hidden patterns automatically.
Tasks:
Clustering
Dimensionality Reduction
Association Discovery
Cluster 2
Cluster 1
Introduction to Machine Learning 19 / 27
Unsupervised Learning
Definition
Only input features (X ) are available.
No target/output variable (Y ) is provided.
The objective is to discover hidden patterns in data.
The algorithm groups similar instances into clusters.
X = {x1 , x2 , . . . , xn }
Given a set of features, cluster them or summarize them.
Introduction to Machine Learning 20 / 27
Unsupervised Learning: Clustering
X
Cluster 1
Input 1 Learning
Input 2 Algorithm Cluster 2
..
.
Cluster 3
Input n
How are clusters formed?
Based on similarity among data instances
Introduction to Machine Learning 21 / 27
Learning Associations
Association Learning
Association learning discovers relationships among items that frequently occur together.
Example
Customers who buy Bread often buy Butter.
Bread Butter
Association Rule
Applications:
Market Basket Analysis
Recommendation Systems
Customer Behavior Analysis
Introduction to Machine Learning 22 / 27
Reinforcement Learning
Definition
In Reinforcement Learning, an agent learns by interacting with the environment and receiving
rewards or penalties.
Applications:
Robotics
Self-driving Cars
Chess and Game Playing
Resource Optimization
Introduction to Machine Learning 23 / 27
Reinforcement Learning
Action At
Agent Environment
State St+1 , Reward Rt+1
Learns a Policy π Provides Feedback
Agent interacts with the environment.
Agent chooses an action based on the current state.
Environment returns a new state and reward.
Goal: Maximize cumulative reward over time.
Introduction to Machine Learning 24 / 27
Components of Reinforcement Learning
Agent: Learner / decision maker (self-driving car)
Environment: Road, traffic signals, other vehicles
States (S): Current Situation of the environment
S1 : Red Signal
S2 : Green Signal
Actions (A): Set of possible moves taken by the agent.
A1 : Stop
A2 : Go
Reward (R): Feedback signal from the environment.
R(S1 , A1 ) = +10 (Safe behaviour)
R(S1 , A2 )= -50 (Traffic Violation)
R(S2 , A2 )= +50 (Correct Action)
R(S2 , A1 )= -5 (Unnecessary Stop)
Policy (π): Strategy used by the agent to select action overtime, the car learns the rule
(Policy)
Introduction to Machine Learning 25 / 27
Comparison of Learning Types
Learning Type Data Output
Classification Labeled Category
Regression Labeled Numeric Value
Unsupervised Unlabeled Hidden Patterns
Reinforcement Rewards Optimal Action
Introduction to Machine Learning 26 / 27
Summary
Machine Learning enables systems to learn from data.
ML is widely used in healthcare, finance, and automation.
Classification predicts categories.
Regression predicts numerical values.
Unsupervised Learning finds hidden structures.
Reinforcement Learning learns through rewards.
Introduction to Machine Learning 27 / 27