AI 6
AI 6
AI 6
Q. What is supervised learning and its types with an example. How it works
with advantages and disadvantages.
Supervised Learning is a type of machine learning where a model is trained using a labelled
dataset. In this context, "labelled" means that each training sample is paired with an output
label or value that the model is trying to predict or classify. The model learns to map the input
data to the correct output by finding patterns in the data, and the goal is to generalize this
learning so that the model can make accurate predictions on unseen data.
Types of Supervised Learning
Supervised learning can be broadly classified into two main types:
1. Classification: In classification tasks, the output variable is categorical. The model
learns to assign input data to one of several predefined classes or categories.
• Example: Email spam detection, where the model classifies emails as "spam"
or "not spam."
2. Regression: In regression tasks, the output variable is continuous. The model predicts
a numerical value based on the input data.
• Example: Predicting house prices based on features like size, location, and
number of bedrooms.
How Supervised Learning Works
1. Data Collection: Gather a labelled dataset that includes input features and
corresponding output labels.
2. Data Preprocessing: Clean and prepare the data for training, which may involve
handling missing values, normalizing data, and splitting the dataset into training and
testing sets.
3. Model Selection: Choose an appropriate algorithm (e.g., decision trees, support
vector machines, neural networks) for the task.
4. Training the Model: Use the training dataset to teach the model by adjusting its
parameters to minimize the difference between predicted and actual outputs.
5. Evaluation: Test the model on a separate testing dataset to assess its performance
using metrics like accuracy, precision, recall, or mean squared error.
6. Prediction: Once trained and validated, the model can make predictions on new,
unseen data.
Advantages of Supervised Learning:
1. High Accuracy: Supervised learning can achieve high accuracy because the model is
trained on labelled data, providing clear guidance on the correct answer.
2. Clear Objective: Since the model knows the correct outputs (labels), it is easy to
evaluate its performance using common metrics (accuracy, precision, recall, etc.).
3. Versatile: It can be applied to a wide variety of tasks, such as classification and
regression, making it suitable for many different industries.
4. Easy to Interpret: The model’s behaviour is easier to understand because the
relationship between inputs and outputs is explicitly learned.
Disadvantages of Supervised Learning:
1. Requires Labelled Data: A major limitation is the need for labelled data, which can
be expensive, time-consuming, and sometimes impractical to obtain.
2. Overfitting: If the model learns too much detail from the training data (especially
with a small dataset), it may perform well on the training set but poorly on new,
unseen data. This is called overfitting.
3. Limited Generalization: If the training data does not cover the full range of possible
scenarios, the model may not generalize well to new or unseen data.
4. Bias in Data: If the labeled data is biased or unrepresentative, the model may learn
and perpetuate those biases, leading to unfair or inaccurate predictions.
Applications of Supervised Learning:
• Classification Applications:
▪ Email spam filtering.
▪ Image recognition (e.g., identifying objects in images).
▪ Sentiment analysis (e.g., classifying tweets or product reviews as positive or
negative).
▪ Medical diagnosis (e.g., classifying X-ray images as normal or abnormal).
• Regression Applications:
▪ Predicting house prices based on features like size and location.
▪ Forecasting sales for a company.
▪ Estimating stock prices or market trends.
▪ Predicting the amount of rainfall or temperature.
Real-Time Not real-time; needs Can adapt without Learns in real-time through
Learning retraining. retraining. interaction.
Human Needs human effort for Minimal human May require human guidance
Involvement labelling. involvement. for rewards.
Skills Needed Organization and strategic thinking. Critical thinking and creativity.
Success
Measurement Achieving set goals. Effectiveness of the solution.
Q.