1.
Explain Supervised Learning with a Suitable Example
Supervised Learning is a type of machine learning where the model is trained using labeled
data. In this method, the input data is provided along with the correct output (target value),
and the algorithm learns the relationship between the input and output.
The main objective of supervised learning is to learn a mapping function from input
variables to output variables so that the model can predict the correct output for new,
unseen data.
Supervised learning problems are mainly divided into two types:
1. Classification – The output is a category or class label.
Example: Email spam detection (Spam or Not Spam).
2. Regression – The output is a continuous numerical value.
Example: Predicting house prices.
Example
Consider a student exam result prediction system. A dataset may contain information such
as:
• Hours studied
• Attendance percentage
• Previous marks
Along with the final result (Pass or Fail).
Using this labeled dataset, the machine learning model learns the relationship between the
input features (study hours, attendance, marks) and the output (Pass/Fail). After training, the
model can predict whether a new student will pass or fail based on their study data.
Last c
Thus, supervised learning uses labeled training data to train a model so that it can predict
accurate outputs for new inputs. It is widely used in applications such as spam detection,
medical diagnosis, speech recognition, and recommendation systems.
Explain Unsupervised Learning with an Example
Unsupervised Learning is a type of machine learning where the algorithm learns patterns
from unlabeled data. In this method, the dataset does not contain any predefined output
labels. The goal of the algorithm is to discover hidden patterns, structures, or
relationships in the data.
Unlike supervised learning, there is no correct output provided during training. The system
tries to organize the data into meaningful groups based on similarities.
Unsupervised learning mainly includes the following techniques:
1. Clustering – Grouping similar data points together.
2. Association – Finding relationships between variables in a dataset.
Example
A common example of unsupervised learning is customer segmentation in marketing.
Suppose a company has a dataset containing information about customers such as:
• Age
• Income
• Spending habits
The data does not include any predefined categories. Using a clustering algorithm such as K-
Means, the system automatically groups customers into different clusters based on similar
characteristics. For example:
• High-income, high-spending customers
• Low-income, moderate-spending customers
• Young customers with frequent purchases
These groups help businesses design targeted marketing strategies.
Thus, unsupervised learning analyzes unlabeled data to identify patterns and structures. It
is widely used in applications such as customer segmentation, anomaly detection,
recommendation systems, and pattern discovery.
Explain Decision Trees and the Difference Between Univariate and Multivariate Trees
A Decision Tree is a supervised machine learning algorithm used for classification and
regression tasks.
It works by splitting the dataset into smaller subsets based on certain conditions. The
structure of a decision tree resembles a tree, where each internal node represents a test on a
feature, each branch represents the result of the test, and each leaf node represents the final
decision or prediction.
The main advantage of decision trees is that they are simple to understand and interpret.
They mimic human decision-making by asking a sequence of questions to reach a final
outcome.
Example
Consider a system that predicts whether a student will pass or fail based on the number of
study hours.
• If study hours > 5 → Pass
• If study hours ≤ 5 → Fail
The model splits the data based on the condition and reaches a final decision.
Difference Between Univariate and Multivariate Decision Trees
Univariate Decision Tree Multivariate Decision Tree
Uses only one feature to make a split at
Uses multiple features together to make a split.
each node.
The decision condition depends on a The decision condition depends on a
single variable. combination of variables.
More complex but can capture more complex
Simpler and easier to interpret.
relationships.
Univariate Decision Tree Multivariate Decision Tree
Example: Split based only on study Example: Split based on study hours and
hours. attendance together.
Decision trees are widely used in machine learning because they are easy to understand and
visualize. Univariate trees use one variable at a time, while multivariate trees use multiple
variables together to make more complex decisions.