0% found this document useful (0 votes)
64 views26 pages

AI Module-3 QB Solutions

The document outlines various techniques in Artificial Intelligence, including Neural Networks, Machine Learning, Deep Learning, Natural Language Processing, Computer Vision, and Cognitive Computing, explaining their functions and applications. It also discusses the components of Machine Learning models, the differences between supervised and unsupervised learning, and the steps to create Decision Trees. Additionally, it covers regression types and their real-world applications, along with differentiating key concepts in machine learning.

Uploaded by

madhumitacse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views26 pages

AI Module-3 QB Solutions

The document outlines various techniques in Artificial Intelligence, including Neural Networks, Machine Learning, Deep Learning, Natural Language Processing, Computer Vision, and Cognitive Computing, explaining their functions and applications. It also discusses the components of Machine Learning models, the differences between supervised and unsupervised learning, and the steps to create Decision Trees. Additionally, it covers regression types and their real-world applications, along with differentiating key concepts in machine learning.

Uploaded by

madhumitacse
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MODULE-3 QUESTION BANK with SOLUTIONS

1. Explain the major techniques in Artificial Intelligence with suitable examples.

Techniques in AI
Artificial intelligence (AI) works by combining massive data with fast, iterative
processing and intelligent algorithms, allowing the software to automatically learn to deduce
patterns in data. The sub-domains of AI are given in Fig. 2.1.

1. Neural Networks: Neural networks work in the same way as human neural (brain) cells
work. A series of nodes that capture the relationship between various underlying variables and
processes the data. Every node (or neuron) processes information by responding to external
inputs and relaying information between each unit. The entire process of Learning requires
multiple passes at the data to derive meaning from undefined data (refer to Fig. 2.2).Note that
even the most basic neural network consists of the following layers: An input layer, which is
the layer from where data enters the network.

At least one hidden layer, where machine learning algorithms process the inputs. Weights,
biases and thresholds are applied to the received inputs and the results of processing are passed
to the output layer. An output layer is the layer that gives the final result to be displayed.

2. Machine learning: Machine learning (ML) is a branch of computer science that analyses
data and identifies patterns to teach a machine to deduce results and make decisions without
any human intervention. ML algorithms learn from experiences rather than instructions. They
automatically learn and improve by learning from their output. For this, Humans do not have
to write instructions for them to produce the desired [Link] learn by analysing data sets
and comparing the final output. In case of any error, they repeat the learning process until the
accuracy of the outputs [Link] automation not only saves human time and effort but also
makes better decisions. In chapter 1, we have already seen that technologies like Machine
Learning, Natural Language Processing, Deep Learning are all sub domains of Artificial
Intelligence (refer Fig. 2.3)

3. Deep learning: Deep learning is an ML technique that teaches a machine to process inputs through
layers to more accurately classify, infer and predict an outcome. DL creates huge neural networks
with several layers of processing units to take full advantage of advances in computing power and
improved training techniques. This helps the algorithm to learn complex patterns in large amounts of
data. Some applications of DL include image and speech recognition.
Deep learning models are based on deep neural networks (refer Fig. 2.4), that is, neural
networks with multiple hidden layers. In such a network, each hidden layer further processes
the temporary outputs received from the previous layer. This movement of computations
through the hidden layers to the output layer is known as forward propagation. Once the final
result is produced by the output layer, its accuracy is calculated. In case of unsatisfactory
results, errors are identified, weights assigned to each node are updated, and pushed back to the
previous layers to refine or train the model. This process of moving backward to update weights
of all nodes is known as backward propagation. Deep learning models can work with labeled
as well as unlabelled data. This means that deep learning supports both supervised and
unsupervised learning.

4. Natural language processing: NLP is a science in which a machine is made to read,


understand, interpret and respond to a human language. This is specifically done to make
machine capable of communicating with a human.

5. Computer vision: Computer vision is a branch of AI that tries to understand an image by


breaking it down into several parts and then studying each part of the image. This helps
machine to classify and learn from a set of images so that it can make better decisions based
on previous observations. For example, when a machine can process, analyse and understand
images, they can capture images or videos in real time and interpret their
surroundings. Computer vision techniques are used today for facial recognition that helps in
surveillance and security systems, autonomous vehicles, retail stores for tracking inventory and
customers, in medicine for diagnosing diseases, in financial Institutions to prevent fraud, and
so on.

6. Cognitive Computing: Cognitive computing algorithms try to mimic the human brain by
analysing text, speech, images or objects in the same way to give the desired output. It is
basically a subfield of AI that is used to provide a natural, human-like interaction with
machines. The ultimate goal of using cognitive computing is to make the machine speak
coherently in response to a human. Apart from the above-mentioned techniques, some
additional technologies that enable and support AI include the following:
1. Graphical processing units that provide heavy computing power required for iterative
processing and training neural networks.
2. Internet of Things to generate massive amounts of data from connected devices. Usually,
this data remains unanalysed.

2. Write Basic neural network model explaining the function of each layer.

A Neural Network is a computational model inspired by the human brain. It consists of


interconnected layers of nodes (neurons) that process input data to produce meaningful outputs.

A basic neural network generally includes three main layers:


1. Input Layer
2. Hidden Layer(s)
3. Output Layer
Each layer performs a specific function and contributes to learning patterns in data.

1. Input Layer

• The input layer is the first layer of the network.


• It receives raw data features (e.g., pixels of an image, numerical values, text
embeddings).
• No computations are performed here; data is just passed to the next layer.
Example: If predicting house prices using size, location, and rooms
→ these three features form the input layer.

2. Hidden Layer(s)

• These layers perform most computations in the network.


• Each neuron applies:
o Weighted sum: Z=W1X1 + W2X2 +….+b

o Activation function like ReLU, Sigmoid, or Tanh to introduce non-


linearity.
• Hidden layers extract deeper features, patterns, and relationships. Example: In image
processing, hidden layers detect edges, shapes, and textures.

3. Output Layer

• Produces the final prediction or classification.


• Activation depends on the task:
o Softmax → multi-class classification
o Sigmoid → binary classification
o Linear function → regression
Example: Output can be a class label like “spam” or “not spam”.

4. Learning Process

• Neural networks learn by adjusting weights using backpropagation


and gradient descent.
Error between predicted and actual output is minimized during training.

3. ML Model is a combination of Task, Performance and Experience”, Explain with


suitable an example.

A Machine Learning (ML) model is defined by three key components:


Task (T), Performance Measure (P), and Experience (E).
According to Tom Mitchell’s definition, “A machine learns from experience E with respect to a task
T and performance measure P, if its performance at the task improves with experience.”

1. Task (T)

• The Task is the specific problem the model is supposed to solve.


• It could be classification, prediction, recognition, or recommendation.
• It determines what output the ML system should generate.

2. Performance (P)

• Performance measures how well the model completes the task.


• It uses metrics such as accuracy, precision, recall, error rate, RMSE, etc.
Higher performance means the model is doing the task better.

3. Experience (E)
• Experience refers to the data the model learns from.
• More high-quality data leads to better learning.
• Experience allows the model to improve performance over time.

Example: Email Spam Classification

Consider an ML model that filters emails into “spam” or “not spam”.

Task (T):

Classifying incoming emails into spam or non-spam categories.

Performance (P):

Measured by accuracy or F1-score of correctly identified spam emails.

Experience (E):

The dataset of thousands of labeled emails (spam and non-spam) used for training.

As the model is trained with more labeled emails (experience), it starts recognizing patterns such as
suspicious keywords, sender addresses, and abnormal formatting.

With increased data and learning, its accuracy improves.


Thus, the ML model improves its performance (P) at the task (T) as it gains more experience (E).
4. Is Labelled data supervised or unsupervised machine learning? Extend your answer
explaining different types of machine learning.

Labelled data is used in Supervised Machine Learning.


In supervised learning, the dataset contains both input features (X) and correct output labels (Y).
The model learns a mapping from inputs to outputs using these labels.

Why Labelled Data Belongs to Supervised Learning


In supervised learning, every training example has a known outcome

• The model “learns by example” and adjusts its predictions to match the labelled outputs.
Example:
Email → “spam” or “not spam”, Image → “cat” or “dog”.

Since the data is labelled, the model can compare its predictions with the truth and improve through
training.

Types of Machine Learning

1. Supervised Learning

• Uses labelled data (input + known output).


• Task: classification or regression.
• The model predicts labels for new data.
Examples:
Spam detection, disease prediction, house price prediction.

2. Unsupervised Learning

• Uses unlabelled data (only inputs, no output labels).


• The model discovers hidden patterns or groups.
• Task: clustering, dimensionality reduction, association.
Examples:
Customer segmentation, grouping news articles, market basket analysis.

3. Semi-Supervised Learning

• Combination of a small amount of labelled data + a large amount of unlabelled data.


• Useful when labeling is expensive or time-consuming.
Examples:
Speech recognition, web page classification.

4. Reinforcement Learning
The model learns through trial and error by receiving rewards or penalties.
• Used for sequential decision-making.

Examples:
Game playing (Chess, Go), robotics navigation, self-driving cars.

5. Explain the four steps to create Decision Trees with suitable example for each step.
A Decision Tree is a supervised learning model used for classification and
regression. Building a decision tree involves four essential steps.

1. Data Collection and Preprocessing

Gather relevant data and prepare it by handling missing values, removing duplicates, and selecting
useful features.

Example:

For predicting whether a customer will buy a product, collect data such as:
• Age
• Income
• Previous purchase history
• Product interest
Clean the data before training the model.

2. Selecting the Best Attribute Using Splitting Criteria

Choose the attribute that best separates the data. Common criteria:
• Gini Index
• Information Gain
• Gain Ratio Example:
If attributes are Age, Income, and Purchase History,
and Purchase History gives the highest Information Gain, the tree will split first
based on Purchase History.

3. Splitting the Data and Creating Branches


Based on the chosen attribute, divide the dataset into subsets and create branches.
Each branch represents an outcome of the attribute.

Example:
If splitting by Income, the branches may be:
• Income = Low
• Income = Medium
• Income = High
Each branch contains only the data that matches that category.

4. Repeating the Process Until a Stopping Condition is Met


Continue splitting until:

• All samples in a node belong to the same class, OR


• No attributes remain, OR
• Maximum depth is reached.

Example:
After splitting on Income, the next best attribute might be Age.
If all remaining records belong to “Buy = Yes”, the node becomes a leaf node.

[Link] how Linear Regression, Logistic Regression, and Polynomial Regression can
be applied to analyze and predict real-world data in Artificial Intelligence and
Machine Learning.

• In Artificial Intelligence and Machine Learning, regression models play a major role in
understanding data patterns and making predictions.
• Each type of regression is useful for different kinds of problems.

Below is a clear explanation of how Linear Regression, Logistic Regression, and Polynomial
Regression are applied in real-world scenarios.

1. Linear Regression

Linear Regression is used when we want to predict a continuous value and understand how one
variable affects another. It assumes a straight-line relationship between the inputs and output.

Real-world applications:
• House Price Prediction: Predicting the cost of a house based on size, number of
rooms, location, etc.
• Sales Forecasting: Companies use it to estimate future sales based on past data.
• Temperature Prediction: Weather departments use it to forecast temperature trends.

Linear Regression is simple yet powerful for finding trends and making numeric predictions.

2. Logistic Regression

Logistic Regression is used when the output is categorical (yes/no, true/false, spam/not spam).
Instead of predicting numbers, it predicts probabilities that are later converted into class labels.

Real-world applications:

• Disease Detection: Predicting whether a patient has diabetes or not based on medical
features.
• Email Spam Detection: Classifying emails as spam or not spam.
• Customer Churn Prediction: Identifying whether a customer will leave a service or stay.

Logistic Regression is widely used because it is simple, explainable, and effective for classification
problems.

3. Polynomial Regression

Polynomial Regression is used when data shows a curved or non-linear relationship.

It extends linear regression by adding higher-degree terms (like x², x³) to capture complex patterns.

Real-world applications:

• Traffic Flow Prediction: Traffic volume often increases in non- linear patterns during
the day.
• Growth Trend Analysis: Modeling population growth, business revenue growth, or crop yield over tim
• Sensor Data Modeling: In IoT and robotics, many physical processes follow
curved patterns.
Polynomial Regression helps when a straight line is not enough to describe the data accurately.

[Link] between the following:


(i) Supervised and Unsupervised Machine Learning
(ii) Forward and Backward Propagation
(iii) Classification and Regression

Supervised And Unsupervised Learning


Supervised Learning Unsupervised Learning
Works with labeled data (input + Works with unlabeled data (only
correct output). input).
The goal is to learn a mapping The goal is to find hidden
from input to output. patterns or groupings.
Used for classification and Used for clustering and
regression. dimensionality reduction.
Example: Predicting house Example: Customer grouping,
prices, spam detection. anomaly detection.

Classification and Regression


Classification Regression
Classification is a machine learning task Regression is a machine learning task where
where the model predicts a category or the model predicts a numerical value.
label.
Output is categorical (labels). Output is numerical (continuous value).
Answers “Which class?” Answers “How much?” or “What value?”
Example: Email spam/not spam, Example: Predicting house price,
disease prediction. temperature.
Uses algorithms like SVM, Decision Tree, Uses Linear Regression, Polynomial
Logistic Regression. Regression.

Forward and Backward Propagation

Forward Propagation Backward Propagation


Data moves from input → output layer. Error moves from output →input layer.
The model makes predictions using current The model updates weights to reduce
weights. error.
Computes output values. Computes gradients using the chain rule.
Happens before backpropagation in training. Happens after forward pass.

[Link] K-Means Algorithm with merits and demerits.

The K-Means algorithm is a popular unsupervised learning technique used to partition a dataset
into K distinct clusters.

It groups data based on similarity, where each cluster is represented by its centroid.
Example:
Customer Income (₹K) Debt (₹K)
A 50 10
B 40 15
C 70 25
D 90 20
E 60 30
we have a dataset of customers with two features: Income and Debt. We want to group
customers into 2 clusters (k=2).
Step 1: Choose number of clusters
We are given
k = 2, so we want 2 groups of customers.
Step 2: Initialize centroids (randomly)
Assume we randomly pick two customers as initial centroids:
• Centroid 1 (C1) = Customer A (50, 10)

• Centroid 2 (C2) = Customer D (90, 20)

Step 3: Calculate distance of each point to centroids


We use Euclidean distance:
𝐷𝑖𝑠𝑡𝑎𝑛𝑐𝑒 = √(𝑥2 − 𝑥1 )2 + (𝑦2 − 𝑦1 )2

Customer Distance to C1 (50,10) Distance to C2 (90,20) Assigned Cluster


A (50,10) 0 √((40)²+(10)²)=41.2 Cluster 1
B (40,15) √(10²+5²)=11.2 √(50²+5²)=50.2 Cluster 1
C (70,25) √(20²+15²)=25 √(20²+5²)=20.6 Cluster 2
D (90,20) 41.2 0 Cluster 2
E (60,30) √(10²+20²)=22.4 √(30²+10²)=31.6 Cluster 1

Step 4: Form clusters


• Cluster 1 → A, B, E
• Cluster 2 → C, D

Step 5: Recalculate centroids


New Centroid of Cluster 1 (A, B, E)
𝐼𝑛𝑐𝑜𝑚𝑒 = (50 + 40 + 60)/3 = 50
𝐷𝑒𝑏𝑡 = (10 + 15 + 30)/3 = 18.3

➡ New C1 = (50, 18.3)


New Centroid of Cluster 2 (C, D)
𝐼𝑛𝑐𝑜𝑚𝑒 = (70 + 90)/2 = 80
𝐷𝑒𝑏𝑡 = (25 + 20)/2 = 22.5

➡ New C2 = (80, 22.5)


Step 6: Repeat assignment
Distances are recalculated using new centroids.
Since cluster assignments do not change, the algorithm converges.
K-Means clustering groups customers based on similarity by iteratively assigning
points to the nearest centroid and updating centroids until cluster assignments stabilize.

9.A company decides to carry out its business operations on a rented space. If the cost of
the rental space is Rs 20000 plus Rs 500 per employee per day, then compute monthly
rental for space given that the company is open 5 days a week. Show a linear equation
for this scenario with explanation.

A company rents office space with the following cost structure:

• Fixed rental cost: Rs 20,000


Variable cost: Rs 500 per employee per day
• Company works 5 days a week

Let x = number of employees.

1. Forming the Linear Equation

2. Explanation of Linear Equation

3. Interpretation

• If the company hires more employees, the rent increases proportionally


(linearly).
• The base Rs 4,00,000 is always paid regardless of number of employees.

[Link] conditional probability and the Bayes rule with examples.

Conditional Probability

Conditional probability refers to the probability of an event happening given that another event has
already happened.
It helps us update our belief when we have additional information.

Formula:

Example:

Suppose in a class,

• 40% of students like Maths (Event A),


• 30% like Science (Event B),
• 20% like both Maths and Science.

Then the probability that a student likes Maths given they like Science is:

So, there is a 67% chance the student likes Maths if we already know they like Science.

Bayes’ Rule
Bayes’ Rule is used to find the probability of a cause given an outcome.
It helps in situations where we reverse probabilities or update predictions based on new evidence.

Formula:

Example (Medical Test):

A disease affects 1% of the population.


A test detects the disease correctly 90% of the time. False positive rate
is 5%.
Let:

• A = Person has the disease


• B = Test result is positive

So even after testing positive, the chance of actually having the disease is only 15.1%.

[Link] how Machine Learning, Deep Learning, and Natural Language Processing
techniques can be applied to solve real-world problems in Artificial Intelligence.
Artificial Intelligence uses several core techniques-Machine Learning (ML), Deep Learning (DL),
and Natural Language Processing (NLP)-to solve complex real-world problems.

Each technique contributes in a unique way and helps automate tasks that normally require human
intelligence.

1. Machine Learning (ML)

Machine Learning allows systems to learn patterns from data and make predictions without being
explicitly programmed.

Applications:

• Fraud Detection:
Banks train ML models on past transaction data to identify unusual spending patterns and block
fraudulent activities.

• Product Recommendations:
E-commerce platforms like Amazon use ML to analyze customer behavior and suggest
relevant products.
• Disease Prediction:
ML can predict the risk of diabetes or heart disease based on patient history and medical
records.

ML is useful when the problem has clear patterns, and the data can be represented in numbers or
categories.
2. Deep Learning (DL)

Deep Learning is a subset of ML that uses artificial neural networks with many layers to handle
more complex patterns.

Applications:

• Image Recognition:
DL powers systems like facial recognition, medical image scanning (X-ray/CT analysis),
and autonomous cars detecting pedestrians.
• Speech Recognition:
Assistants like Siri or Google Assistant use deep neural networks to convert speech into text
accurately.
• Self-Driving Cars:
DL models understand road signs, lanes, obstacles, and moving objects in real time.

DL is especially useful for unstructured data like images, audio, and videos.

3. Natural Language Processing (NLP)

NLP enables machines to understand, interpret, and generate human language.

Applications:

• Chatbots and Virtual Assistants:


Customer support chatbots use NLP to understand queries and respond like a human.
• Sentiment Analysis:
Companies analyze customer reviews and social media posts to understand public opinion.
• Language Translation:
Tools like Google Translate convert text or speech between languages.
NLP helps machines deal with text, speech, and human communication.

12. Summarize the features of:


(i) Reinforcement Learning
(ii) Support Vector Machines (SVM)

(i) Reinforcement Learning (RL) – Features

1. Learning by Interaction:
The agent learns by interacting with an environment and receiving rewards or penalties.
2. Goal-Oriented Learning:
The main objective is to maximize total reward over time.
3. Trial-and-Error Approach:
RL improves its actions through repeated experiments.
4. Delayed Rewards:
The outcome of an action may not be immediate; future rewards influence decisions.
5. Exploration vs. Exploitation:
The agent must balance trying new actions (exploration) and using known best actions
(exploitation).
6. Policy-Based Learning:
The agent learns a policy-a mapping from states to the best possible actions.

(ii) Support Vector Machines (SVM) – Features

1. Maximum Margin Classifier:


SVM finds the best boundary (hyperplane) that maximizes separation between classes.
2. Effective for High-Dimensional Data:
Works well when the number of features is large (e.g., text classification).
3. Uses Kernel Trick:
Can handle non-linear data using kernels like RBF, polynomial, or sigmoid.
4. Robust to Overfitting:
SVM performs well even with small datasets due to margin maximization.
5. Binary Classification Method:
Primarily designed for two-class problems but can be extended to multi-class tasks.
6. Support Vectors:
Only a few critical data points (support vectors) determine the decision boundary.

13. How does computer vision work with deep learning? Explain the tasks involved in
computer vision.

Computer vision helps machines see and understand images, just like humans do.

Deep Learning boosts computer vision by using neural networks, especially Convolutional Neural
Networks (CNNs), to automatically learn patterns such as shapes, edges, objects, and scenes.

How it works:

1. Image Input:
An image is fed into a deep learning model as a grid of pixels.
2. Feature Extraction (CNN Layers):
The network automatically detects features-edges, colors, textures- without manual
programming.
3. Pattern Learning:
Deeper layers learn complex patterns such as faces, vehicles, or text.
4. Classification/Detection:
The model then identifies what is in the image (e.g., “cat”, “tree”) or locates objects with
bounding boxes.
5. Decision Output:
The system outputs predictions or decisions such as “object detected”, “person found”,
or “lane identified”.
Deep learning helps computer vision achieve high accuracy and automatic feature learning, making
it better than traditional manual image processing.

Tasks Involved in Computer Vision

1. Image Classification:
Predicting what category an image belongs to (e.g., dog vs. cat).
2. Object Detection:
Identifying where objects are in the image (e.g., detecting pedestrians for self-driving cars).
3. Image Segmentation:
Splitting the image into meaningful regions—for example, separating background from
objects.
4. Face Recognition:
Identifying or verifying a person from an image.
5. Image Generation / Enhancement:
Creating new images (e.g., AI art) or improving quality (denoising, upscaling).

14. Explain K-Nearest Neighbour (KNN) algorithm with advantages and


drawbacks

o KNN is a simple algorithm that classifies a new data point based on its nearest neighbours in
the dataset.
o The K-Nearest Neighbors (KNN) algorithm is a supervised learning method that classifies data
points based on the similarity of nearby data points. It is used for classification and regression
tasks.

o “K” means the number of neighbors to look at.


Example:
Advantages
o Very simple to understand and use.
o No training phase needed (called a lazy learner).
o Works well for small datasets.

Disadvantages
o Slow when the dataset is large (computes distance for every point).
o Sensitive to how data is scaled (feature scaling is important).
o Choice of K affects accuracy — too small or too large K can cause errors.

15. Explain random forest algorithm with example along with advantages and drawbacks.

Advantages
o Gives high accuracy compared to a single decision tree.
o Reduces overfitting, making the model more reliable.
o Works well on large and complex datasets.
Disadvantages
o Takes more computation time and memory.
o The model becomes harder to interpret (not as clear as a single tree).

16. Explain the various types of clustering techniques with examples.


17. Explain the types of Unsupervised machine learning algorithms along with the
working.
18. Explain the categories of supervised machine learning with the working.

You might also like