Unit3 MachineLearning
Unit3 MachineLearning
UNIT 3
Machine Learning
Fundamentals, Types & Applications
Topics Covered
Q11. Definition & Features of Machine Learning
Q12. Concept & Importance of Machine Learning
Q13. Relationship between AI and Machine Learning
Q14. Comparison of AI and Machine Learning
Q15. Types of Machine Learning
Q16 & Q17. Supervised Learning with Examples
Q18. Unsupervised Learning and Applications
Page 1 of 19
Unit 3 — Machine Learning | Study Notes
Definition
Machine Learning (ML) is a subset of Artificial Intelligence (AI) that enables computer systems to
automatically learn and improve from experience without being explicitly programmed for every
task. ML algorithms build mathematical models from sample data, known as training data, and use
those models to make predictions or decisions on new, unseen data.
Key Definition (Arthur Samuel, 1959): "Machine Learning is the field of study that gives
computers the ability to learn without being explicitly programmed."
In modern terms, Machine Learning is the process by which a computer system identifies patterns
in large datasets, learns from those patterns, and uses that knowledge to perform tasks intelligently
— improving its performance over time with more data.
2. Data-Driven Approach
The performance and accuracy of an ML model are entirely dependent on the quality, quantity, and
diversity of the data used to train it. More relevant data leads to better predictions.
3. Pattern Recognition
ML excels at detecting hidden patterns, trends, and relationships within large, complex, and high-
dimensional datasets — tasks that would be practically impossible for humans to do manually.
4. Generalization
A well-trained ML model does not simply memorize training data; it generalizes from it — applying
learned patterns to new, unseen inputs accurately. This property is what makes ML practically
useful.
5. Adaptability
ML models can adapt dynamically to changing data distributions. When exposed to new
information, models can be retrained to maintain accuracy, making them suitable for evolving real-
world environments.
Page 2 of 19
Unit 3 — Machine Learning | Study Notes
8. Scalability
ML algorithms scale efficiently with increasing data volumes. As more data becomes available,
models can be retrained to deliver higher accuracy without fundamentally changing their
architecture.
9. Self-Improvement
Through iterative training cycles and feedback loops, ML systems improve their accuracy and
reliability over time — a property that distinguishes ML from conventional rule-based software.
Page 3 of 19
Unit 3 — Machine Learning | Study Notes
• Data: Data is the raw material fed into the ML system. It includes labeled or unlabeled
examples from which the model learns.
• Algorithm: An Algorithm is the mathematical procedure that processes data and builds a
predictive model. Common algorithms include decision trees, neural networks, and support
vector machines.
• Model: The Model is the output of training — a mathematical representation that maps
inputs to outputs. It is then deployed to make predictions on real-world data.
The ML Workflow: Collect Data → Preprocess Data → Choose Algorithm → Train Model →
Evaluate Model → Deploy Model → Monitor & Retrain
The learning process can be understood as an optimization problem: given a dataset, the algorithm
adjusts its internal parameters to minimize a loss function — a measure of how far the model's
predictions deviate from the actual outcomes. Over thousands or millions of iterations, the model
converges towards optimal parameters that yield accurate predictions.
2. Intelligent Personalization
Platforms like Netflix, Spotify, Amazon, and YouTube use ML to analyze user behavior and deliver
personalized recommendations, dramatically improving user engagement and satisfaction.
Page 4 of 19
Unit 3 — Machine Learning | Study Notes
6. Autonomous Vehicles
Self-driving cars rely on ML algorithms to process sensor data, recognize objects, predict the
behavior of pedestrians and other vehicles, and make split-second driving decisions safely.
7. Predictive Analytics
Businesses use ML for demand forecasting, predictive maintenance of industrial equipment, supply
chain optimization, and financial risk modeling — enabling proactive rather than reactive decision-
making.
8. Scientific Discovery
ML accelerates research in genomics, climate science, materials science, and astronomy by
identifying patterns in massive experimental datasets that would take human researchers decades
to analyze manually.
Page 5 of 19
Unit 3 — Machine Learning | Study Notes
Overview
Artificial Intelligence (AI) and Machine Learning (ML) are closely related fields, but they are not
synonymous. Understanding their relationship requires examining their scope, goals, and how they
interact with each other.
Hierarchical Relationship
Page 6 of 19
Unit 3 — Machine Learning | Study Notes
How ML Enables AI
• Learning Capability: ML provides AI systems the ability to improve performance on tasks
over time without being reprogrammed.
• Generalization: ML allows AI to generalize from training examples and handle situations
not explicitly anticipated by programmers.
• Scalability: ML-based AI systems can scale to handle complex, high-dimensional data
(images, speech, text) far beyond the capacity of rule-based systems.
• Feature Discovery: ML lets AI discover features and patterns automatically from raw data,
eliminating the need for manual feature engineering.
Page 7 of 19
Unit 3 — Machine Learning | Study Notes
Comparison Table
Page 8 of 19
Unit 3 — Machine Learning | Study Notes
Page 9 of 19
Unit 3 — Machine Learning | Study Notes
Machine Learning is broadly classified into four main types based on the nature of learning, the type
of feedback provided to the algorithm, and the structure of the training data:
1. Supervised Learning
Definition: The algorithm is trained on a labeled dataset — every input data point is paired with a
corresponding correct output (label). The model learns to map inputs to outputs by minimizing
prediction errors.
In supervised learning, the learning process is analogous to a student learning under a teacher's
supervision: the teacher provides correct answers, the student practices, and errors are corrected
until the student masters the subject.
Examples: Email spam detection, image classification, medical diagnosis, credit scoring, stock price
prediction.
2. Unsupervised Learning
Definition: The algorithm is trained on an unlabeled dataset — no correct outputs are provided.
The model must discover hidden structure, patterns, or groupings in the data on its own.
Unsupervised learning is like exploring an unknown territory without a map — the system must
make sense of its environment autonomously, finding natural groupings and structures.
Examples: Customer segmentation, anomaly detection, topic modeling, gene expression analysis,
recommendation systems.
Page 10 of 19
Unit 3 — Machine Learning | Study Notes
3. Semi-Supervised Learning
Definition: The algorithm is trained on a small amount of labeled data combined with a large
amount of unlabeled data. This approach bridges supervised and unsupervised learning, making
it practical when labeling data is expensive or time-consuming.
Semi-supervised learning is highly valuable in real-world scenarios where obtaining labeled data
requires significant manual effort (e.g., medical image annotation by radiologists). The model uses
the labeled examples as anchors and leverages the structure of unlabeled data to improve
generalization.
Examples: Web content classification, speech recognition, protein structure prediction, medical
imaging when labeled scans are scarce.
4. Reinforcement Learning
Reinforcement learning mimics how humans and animals learn through trial and error: a child
learns to walk by trying, falling, and adjusting — the reward is successful locomotion. The agent has
no labeled dataset; it generates its own experience through interaction.
• Key Component 1: Agent — the entity that takes actions (e.g., a game-playing AI, a robot)
• Key Component 2: Environment — the external system the agent interacts with (e.g., a
game board, physical world)
• Key Component 3: State — the current situation of the agent in the environment
• Key Component 4: Action — a decision the agent makes at each time step
• Key Component 5: Reward — feedback signal indicating the quality of the action taken
• Key Component 6: Policy — the strategy the agent learns; maps states to actions to
maximize reward
Page 11 of 19
Unit 3 — Machine Learning | Study Notes
Formal Definition: Given a training set D = {(x1, y1), (x2, y2), ..., (xn, yn)}, where xi represents
the input features and yi represents the corresponding output label, a supervised learning
algorithm learns a function f such that f(xi) ≈ yi for all training examples, and generalizes
accurately to new unseen inputs.
A) Classification
Classification predicts a discrete category label. The output is one of a finite set of predefined
classes. The model learns decision boundaries that separate the feature space into distinct class
regions.
• Binary Classification: Two possible outputs (e.g., spam/not spam, tumor/benign, pass/fail)
• Multi-class Classification: More than two possible outputs (e.g., handwritten digit recognition:
0–9; species classification)
• Multi-label Classification: Each input can belong to multiple classes simultaneously (e.g.,
tagging a news article with topics: politics, economy, health)
Page 12 of 19
Unit 3 — Machine Learning | Study Notes
B) Regression
Regression predicts a continuous numerical value. The model learns a mapping from input features
to a real-valued output. The goal is to minimize the average error between predicted and actual
values.
• Input Features: Email subject line words, sender address, presence of hyperlinks, email
body keywords (free, win, lottery), email length, HTML content
• Labels: 'Spam' (1) or 'Not Spam' (0) — provided by human annotators reviewing thousands
of emails
Page 13 of 19
Unit 3 — Machine Learning | Study Notes
• Input Features: Number of bedrooms, area in square feet, location (zip code), age of
property, number of bathrooms, garage capacity, proximity to schools
• Labels: Actual sale prices (in USD) from historical real estate transaction records
• Algorithm Used: Multiple Linear Regression or Gradient Boosted Trees (XGBoost)
• Training: Model learns the weighted contribution of each feature to the final price
• Outcome: A model that predicts house prices within a small margin of error, used by real
estate platforms like Zillow (Zestimate)
• Input Features: Pixel values of high-resolution retinal images (2D arrays of RGB values)
• Labels: Expert ophthalmologist diagnoses categorized into 5 severity levels (No DR, Mild,
Moderate, Severe, Proliferative DR)
• Algorithm Used: Convolutional Neural Network (CNN) — a deep learning architecture
• Training: Model trained on over 88,000 labeled retinal images
• Outcome: Google's DiabeticRetinopathy model achieved accuracy matching or exceeding
expert ophthalmologists, enabling early screening in underserved regions
• Input Features: Income, employment status, existing debt, credit history length, number of
late payments, loan amount requested
• Labels: 'Default' or 'No Default' from historical loan repayment records
• Algorithm Used: Random Forest Classifier or Gradient Boosting
• Outcome: Banks and fintech companies use these models to approve or reject loan
applications instantly, reducing default risk significantly
Page 14 of 19
Unit 3 — Machine Learning | Study Notes
Page 15 of 19
Unit 3 — Machine Learning | Study Notes
Definition
Unsupervised Learning is a type of Machine Learning in which the algorithm is trained on data that
has no predefined labels or correct output values. The model is not given explicit guidance about
what to look for; instead, it must autonomously discover hidden patterns, natural groupings,
structures, or relationships within the raw data.
Key Distinction: In Supervised Learning, the model is told what the correct answer is. In
Unsupervised Learning, the model must figure out the structure of data entirely on its own —
there is no 'teacher.'
1. Clustering
Clustering partitions a dataset into groups (clusters) such that data points within the same cluster
are more similar to each other than to points in other clusters. The algorithm determines both the
number of clusters and their boundaries (in most algorithms) from the data itself.
• K-Means Clustering: Partitions data into K clusters by iteratively assigning points to the
nearest cluster centroid and updating centroids. Fast and scalable but requires specifying K
in advance.
• Hierarchical Clustering: Builds a tree-like hierarchy of clusters (dendrogram) by successively
merging or splitting clusters based on similarity. Does not require specifying K in advance.
• DBSCAN (Density-Based Spatial Clustering): Groups points that are closely packed
together, marking points in low-density regions as outliers. Excellent for discovering
arbitrarily-shaped clusters and detecting anomalies.
• Gaussian Mixture Models (GMM): Probabilistic model that assumes data is generated from
a mixture of Gaussian distributions, allowing soft cluster assignments.
2. Dimensionality Reduction
Dimensionality reduction transforms high-dimensional data into a lower-dimensional representation
while preserving as much meaningful information as possible. This is critical for visualization, noise
reduction, and improving computational efficiency.
Page 16 of 19
Unit 3 — Machine Learning | Study Notes
• Principal Component Analysis (PCA): Linear transformation that projects data onto a new
set of orthogonal axes (principal components) that capture maximum variance.
• t-SNE (t-distributed Stochastic Neighbor Embedding): Non-linear technique primarily used
for 2D/3D visualization of high-dimensional data, preserving local relationships between
points.
• Autoencoders: Deep learning-based dimensionality reduction where a neural network learns
a compressed representation (encoding) and then reconstructs the original input (decoding).
• Apriori Algorithm: Finds frequent itemsets in transaction data and generates association
rules based on support, confidence, and lift metrics.
• FP-Growth Algorithm: More efficient than Apriori; uses a tree-based structure to mine
frequent patterns without generating candidate itemsets.
Page 17 of 19
Unit 3 — Machine Learning | Study Notes
Page 18 of 19
Unit 3 — Machine Learning | Study Notes
• High-value loyal customers: frequent buyers with high spending — target with premium
loyalty programs
• Bargain hunters: purchase primarily during sales — target with discount alerts
• New customers: recently acquired — target with onboarding offers and tutorials
• At-risk customers: previously active but lapsing — target with win-back campaigns
Without any labeled data, the ML system reveals these business-critical groupings purely from
behavioral patterns in transaction data.
Page 19 of 19