Introduction to Machine Learning — Session 1
Introduction to Machine Learning — Session 1
1.1 What is Machine Learning?
1.1.1 Traditional Programming vs. Machine Learning
In traditional programming, a human writes explicit rules. The computer applies those rules to data and produces output:
If the rules are imprecise, the output is wrong. The sandwich example illustrates this: the rule "put the pieces together" did not specify that peanut butter and jelly must face inward. The result was a messy sandwich.
In machine learning, the roles are reversed. The human provides data and the desired output. The computer's job is to learn the rules:
This is sometimes called reverse engineering. Instead of writing the program, you give the computer examples of correct behavior and let it discover the program.
Machine learning flips the traditional programming paradigm: the computer writes the rules, given data and desired outcomes.
1.2 IID Data — Independent and Identically Distributed
1.2.1 Independence
Two random variables and are independent if knowing the value of tells you nothing about the value of . Formally:
Equivalently, the joint probability factorizes:
What this means in plain language: the outcome of one data point has no effect on the outcome of any other data point. They carry no information about each other.
The first flip being heads does not change the probability that the second flip is heads. Each toss is a standalone event. ✓
1.2.2 Identically Distributed
A set of random variables is identically distributed if each is drawn from the same underlying probability distribution. That is, for any value :
where is the cumulative distribution function (CDF). All data points share the same mean , the same variance , and the same distributional shape (e.g., all are Gaussian).
Sense-check: pick any student at random. Your best guess for their score is 70, with a typical spread of ±10. No student has a systematically easier or harder test. ✓
1.2.3 Why IID Matters for This Course
- Independence: The pair is independent of for all .
- Identical distribution: Every is drawn from the same joint distribution .
This assumption lets us write the likelihood of the entire dataset as a product:
Without independence, this factorization fails. Without identical distribution, a single model cannot capture all data points. This course focuses on IID data because the core algorithms — linear regression, logistic regression, Naïve Bayes, SVM, decision trees — all rely on this assumption.
IID means every data point is a fresh, independent draw from the same underlying distribution. When this assumption breaks (time series, spatial data, multi-source data), different techniques — covered in other courses — are required.
1.3 The PTE Framework — Defining a Learning Problem
1.3.1 The Formal Definition
The three components:
- Task : What exactly is the job? Classify emails? Predict a price? Recognize handwriting?
- Performance : How will success be measured? Almost always a number — accuracy, mean squared error, average distance before failure.
- Experience : What data can the system learn from? Labeled examples? Unlabeled sensor readings? Games played against itself?
1.3.2 PTE Worked Examples
- Task : Recognize and classify handwritten words from images (map each image to a digit label: 0, 1, ..., 9).
- Performance : The percentage of words the model correctly classified:
- Experience : A database of handwritten images, each labeled by a human with the correct digit.
- Task : Categorize each incoming email as spam or non-spam (ham).
- Performance : The percentage of emails correctly classified:
- Experience : A database of emails where each has been labeled by users as spam or non-spam.
- Task : Play checkers according to the rules.
- Performance : The percentage of games won against opponents.
- Experience : Games played against itself. No human labels. The algorithm plays millions of games. It receives a reward for moves that lead to wins and a penalty for moves that lead to losses. Over time, it learns a policy (a strategy mapping board states to moves) that maximizes cumulative reward. This is fundamentally different from supervised learning. There is no labeled "correct move" for each board state; the algorithm discovers it through trial and error.
- Task : Drive on a four-lane highway using vision sensors.
- Performance : The average distance traveled before an error (as judged by a human overseer). NOT the number of trips completed, NOT accuracy. Why? A system that completed 50 trips at high speed but killed 10 pedestrians is unacceptable. A single catastrophic error outweighs any count of "successful" trips.
- Experience : A sequence of images and steering commands recorded while observing a human driver. Billions of examples are collected before the car ever operates autonomously on a public road.
If you cannot define P, T, and E for a problem, you do not yet have a machine learning problem — you only have an idea. The PTE framework is the first gate every ML project must pass.
1.3.3 Domain Connection
The PTE framework appears in every ML research paper and industry project proposal. Sometimes it appears under different names (e.g., "problem formulation," "objective specification"). Mitchell's 1997 formulation remains the standard. It forces precision. A vague goal like "make the system smarter" cannot be optimized, but "improve classification accuracy on held-out test data from 87% to 92%" can.
1.4 Features, Attributes, Predictors, and Dimensions
1.4.1 Formal Definitions
An entity is a single real-world object (e.g., one specific student). An entity set is the collection of all entities under study (e.g., all students in the batch).
Features (synonyms: attributes, predictors, characteristics, dimensions, independent variables) are the properties used to describe each entity. Formally, each entity is represented as a vector:
where:
- indexes the entity (row number in the dataset)
- is the number of features (the dimensionality)
- is the value of the -th feature for the -th entity
| Feature | Type | Example |
|---|---|---|
| CGPA | Numerical (continuous) | 9.0 |
| Communication skill | Categorical (ordinal) | Average |
| Aptitude | Categorical (ordinal) | Average |
| Programming skill | Categorical (ordinal) | Excellent |
Each student is represented as a 4-dimensional vector:
The target variable (what we want to predict) is: Job Offer (Yes / No).
For a new student with CGPA 9.0, average communication, average aptitude, and excellent programming, the trained model predicts whether they will get a job offer.
1.4.2 High-Dimensional Data
- The curse of dimensionality: data points become sparse in the feature space. The volume of the space grows exponentially with , meaning exponentially more data is needed to maintain the same density of coverage.
- Computational cost: many algorithms scale as or worse.
- Interpretability: a model with 100 features is hard for a human to understand.
Features are the building blocks of every ML model. Different names (attribute, predictor, dimension, characteristic) all refer to the same thing. A measurable property of an entity, organized as a column in the data matrix.
1.5 Types of Machine Learning
1.5.1 The Supervision Spectrum
Machine learning algorithms are categorized by the level of supervision — the nature and timing of the feedback provided during training:
1.5.2 Supervised Learning
In supervised learning, the training data consists of input-output pairs:
where is the feature vector and is the label (the correct answer, provided by a human). The algorithm learns a function such that:
The key word is labeled — every training example has been annotated with the ground truth.
1.5.2.1 Classification
where is the number of classes. The model learns a decision rule .
Examples: spam/ham (K=2), iris species (K=3), digit recognition (K=10), benign/malignant tumor (K=2).The model learns a threshold : if , classify as malignant; otherwise, benign.
With real numbers: suppose mm. A 30 mm tumor → malignant. A 10 mm tumor → benign. Some overlap exists near the boundary (a 24 mm tumor could go either way) — this is the irreducible classification error.
where are learned weights and is the bias term. For any point , compute:
If score , predict malignant. If score , predict benign.
With features, the decision boundary is a -dimensional hyperplane in . More features mean a more complex separating surface.
1.5.2.2 Regression
The model learns a function that predicts a quantity — not a category.
Examples: predicting house price, used car price, stock price, temperature tomorrow, patient's blood pressure.The model learns a function mapping these features to a rupee amount:
If the true price is ₹450,000 and the model predicts ₹435,000, the error is ₹15,000 — acceptable for a price estimate. If the model predicted "expensive" instead of a number, that would be classification, not regression.
1.5.2.3 Supervised Learning Workflow
- Collect training data — labeled examples (the "past experience").
- Identify features from the training data.
- Train the model — it learns the mapping from the labeled examples.
- Test — feed new (unseen) data through to make predictions.
- Evaluate — compare predictions against held-out labels using the chosen performance measure .
1.5.3 Unsupervised Learning
In unsupervised learning, the training data has no labels:
The algorithm receives only the input vectors. Its job: find hidden structure — groups, patterns, associations — without being told what to look for.
1.5.3.1 Clustering
The algorithm (e.g., K-means) groups customers into clusters. It might discover:
- Cluster A: High income, high spending, frequent visits → "big spenders"
- Cluster B: Low income, low spending, infrequent visits → "budget shoppers"
- Cluster C: Medium income, irregular spending → "occasional buyers"
The algorithm finds the groups. A human analyst then names them and decides the business action (e.g., target Cluster A with premium offers).
1.5.3.2 Association Analysis (Market Basket Analysis)
Support: 60% of all transactions contain both bread and beer. Confidence: 90% of transactions that contain bread also contain beer.
The same data, the same association rule — two opposite business strategies, both valid. The algorithm finds the pattern; the business decides the action.
1.5.4 Semi-Supervised Learning
The algorithm uses the structure in to improve learning from the sparse labels in .
- Supervised only: Pay someone to label all 10,000 photos. Expensive, slow, accurate.
- Unsupervised only: Ask the algorithm to find 5 clusters from the raw pixel data. Fast, cheap, but accuracy uncertain.
- Semi-supervised (best of both):
- Manually label only 50 photos (5 classes × 10 examples each).
- Run unsupervised clustering on all 10,000 photos, producing ~5 groups.
- Observe where the 50 labeled photos fall. If all photos labeled "mom" land in the same cluster, label that entire cluster as "mom."
- Repeat for all clusters. Result: all 10,000 photos tagged, only 50 manually labeled.
The algorithm first clusters, then uses the sparse labels to assign meaning to each cluster. This is the practical sweet spot for many real-world problems where labeling is expensive.
1.5.5 Reinforcement Learning
Formal components:
- Agent: The learner / decision-maker.
- Environment: The world the agent operates in.
- State : The situation at time .
- Action : What the agent does at time .
- Reward : Scalar feedback from the environment after taking action in state .
- Policy : A mapping from states to actions — . This is what the agent learns.
The agent's goal: maximize the cumulative reward over time:
where is the discount factor — rewards now are worth more than rewards later.
RL feedback is delayed and indirect. The agent must figure out which of its past actions caused the eventual reward — the credit assignment problem. This makes RL harder than supervised learning, but also far more general. Any problem that can be framed as reward maximization is fair game, from game-playing to robotics to autonomous driving.
1.5.6 Domain Connection
The supervision spectrum is not academic taxonomy . It determines which algorithms you can use, how much labeling budget you need, and what performance guarantees you can expect. In industry, the choice is often pragmatic. Start with unsupervised exploration to understand the data. Label a small subset for semi-supervised prototyping. Then scale to fully supervised when the ROI justifies the labeling cost.
1.6 When to Use Machine Learning (and When Not To)
1.6.1 Three Cases Where ML Is Appropriate
1.6.2 When NOT to Use ML — Deterministic Tasks
- Payroll: Pay = Hours × Rate − Taxes + Deductions. Fully specified arithmetic.
- Bank balance: Balance = Previous Balance + Credits − Debits. Rule-based.
- Vending machine: If (money ≥ price AND button pressed) → dispense product. Pure if-then-else.
Adding ML to these adds complexity, unpredictability, and maintenance burden with no benefit. Use the simplest tool that solves the problem.
Use ML when rules are unknown, unexplainable, or must adapt to individuals. Use traditional programming when rules are known, fixed, and fully specifiable.
1.7 Dimensionality Reduction (Preview)
where () is a matrix whose columns are the top eigenvectors of the data covariance matrix. The transformed vector lives in a lower-dimensional space but retains the bulk of the original data's variance.
PCA does not delete features — it combines them. The effect of eliminated dimensions is captured in the retained principal components. Information is consolidated, not lost.
1.8 Summary — Types of Machine Learning
| Type | Target Variable | Feedback | Example Algorithms |
|---|---|---|---|
| Supervised — Classification | Categorical | Labeled data | Logistic regression, Naïve Bayes, SVM, Decision trees, Neural networks |
| Supervised — Regression | Continuous | Labeled data | Linear regression |
| Unsupervised — Clustering | None (finds groups) | No labels | K-means, Hierarchical clustering, EM |
| Unsupervised — Association | None (finds item relationships) | No labels | Market basket analysis (Apriori) |
| Semi-supervised | Categorical (sparse labels) | Few labeled + many unlabeled | Clustering + label propagation |
| Reinforcement | None (learns policy ) | Delayed reward/penalty | Q-learning, Policy gradient |
1.9 Course Logistics
| Component | Weight | Details |
|---|---|---|
| Quiz (EC1) | 10% | 3 quizzes; best 2 counted. 1 hour, 1 attempt, 24-hour window (Sat 7 PM – Mon 7 PM) |
| Assignment (EC1) | 20% | 2 group assignments (10% each). ~4 weeks to complete |
| Mid-semester (EC2) | 30% | After 8 sessions. Offline at designated centers |
| End-semester (EC3) | 40% | Comprehensive. Offline at designated centers |
ML Lecture 1 notes · Introduction to Machine Learning — Session 1
Summary
Machine Learning lecture covering the PTE framework for defining learning problems, IID data assumptions, feature engineering, types of ML (supervised, unsupervised, semi-supervised, reinforcement learning), and when to apply ML vs traditional programming.
Learning Objectives
Sections Breakdown
Introduces the paradigm shift from traditional programming to ML, where the computer learns rules from data and desired outputs rather than following explicit human-written instructions.
Explains the statistical assumptions of independence and identical distribution that underpin most foundational ML algorithms, with examples and counterexamples.
Presents Mitchell's formal definition of learning with Performance, Task, and Experience components, with worked examples for handwriting recognition, spam filtering, checkers, and autonomous driving.
Defines how entities are represented as feature vectors, introduces dimensionality and the curse of dimensionality.
Covers the supervision spectrum: supervised (classification and regression), unsupervised (clustering and association), semi-supervised, and reinforcement learning with intuitive analogies.
Three cases where ML is appropriate and warnings against using ML for deterministic, rule-based tasks.
Previews PCA as a method for consolidating information from many features into fewer dimensions.
Exam Revision Notes
Below is the distilled, exam-ready core of this lecture. Every entry is built from the full textbook notes above. Use this section for rapid review — but if something doesn't make sense, go back to the full explanation in the main content.
1.1 What is Machine Learning?
Must-know: Machine learning flips the traditional programming paradigm. the computer writes the rules, given data and desired outcomes.
Top pitfall: Confusing this concept with related but distinct ideas
Self-check: What are the key principles of what is machine learning?, and how do they apply in practice?
Connects to: IID Data — Independent and Identically Distributed, The PTE Framework — Defining a Learning Problem, Features, Attributes, Predictors, and Dimensions
1.2 IID Data — Independent and Identically Distributed
Must-know: IID means every data point is a fresh, independent draw from the same underlying distribution. When this assumption breaks (time series, spatial data, multi-source data), different techniques. covered in other courses — are required.
Top pitfall: Trap — two distributions mixed together. Suppose some students get an easy version of the test (mean 85, SD 5). Other...
Self-check: What are the key principles of iid data. independent and identically distributed, and how do they apply in practice?
Connects to: What is Machine Learning?, The PTE Framework — Defining a Learning Problem, Features, Attributes, Predictors, and Dimensions
1.3 The PTE Framework — Defining a Learning Problem
Must-know: If you cannot define P, T, and E for a problem, you do not yet have a machine learning problem. you only have an idea. The PTE framework is the first gate every ML project must pass.
Top pitfall: Confusing this concept with related but distinct ideas
Self-check: What are the key principles of the pte framework. defining a learning problem, and how do they apply in practice?
Connects to: What is Machine Learning?, IID Data — Independent and Identically Distributed, Features, Attributes, Predictors, and Dimensions
1.4 Features, Attributes, Predictors, and Dimensions
Must-know: Features are the building blocks of every ML model. Different names (attribute, predictor, dimension, characteristic) all refer to the same thing. A measurable property of an entity, organized as a column in the data matrix.
Top pitfall: Confusing this concept with related but distinct ideas
Self-check: What are the key principles of features, attributes, predictors, and dimensions, and how do they apply in practice?
Connects to: What is Machine Learning?, IID Data — Independent and Identically Distributed, The PTE Framework — Defining a Learning Problem
1.5 Types of Machine Learning
Must-know: The one-line rule: look at the target variable. If it's a category → classification. If it's a number → regression. Everything else. the algorithm, the math, the evaluation metric — follows from this single distinction.
Top pitfall: Confusing this concept with related but distinct ideas
Self-check: What are the key principles of types of machine learning, and how do they apply in practice?
Connects to: What is Machine Learning?, IID Data — Independent and Identically Distributed, The PTE Framework — Defining a Learning Problem
1.6 When to Use Machine Learning (and When Not To)
Must-know: Use ML when rules are unknown, unexplainable, or must adapt to individuals. Use traditional programming when rules are known, fixed, and fully specifiable.
Top pitfall: Do NOT use ML for deterministic tasks. problems where the output is 100% defined by concrete, known, unchanging rule...
Self-check: What are the key principles of when to use machine learning (and when not to), and how do they apply in practice?
Connects to: What is Machine Learning?, IID Data — Independent and Identically Distributed, The PTE Framework — Defining a Learning Problem
1.7 Dimensionality Reduction (Preview)
Must-know: PCA does not delete features. it combines them. The effect of eliminated dimensions is captured in the retained principal components. Information is consolidated, not lost.
Top pitfall: Trap — "my algorithm can't handle 100 columns, so I'll drop 20." This is a poor decision. Every column represents inf...
Self-check: What are the key principles of dimensionality reduction (preview), and how do they apply in practice?
Connects to: What is Machine Learning?, IID Data — Independent and Identically Distributed, The PTE Framework — Defining a Learning Problem
Was this lecture useful?
BitsNotes AI Assistant
Subject Notes AssistantConfigure AI Chat
Choose how to access the chatbotSigned in as
Powered by BitsNotes — 20 messages per day. No API key needed. Want unlimited access? Use "Bring Your Own Key" mode.
Sign in to use AI Chat
Get 20 free AI messages per day to ask questions about your lecture notes. Sign in with Google or GitHub — it takes 5 seconds.
Sign In to BitsNotesSwitch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.