ARTIFICIAL
INTELLIGENCE
Previous year solution: 2021
1. Discuss the role of reasoning in AI. How is predicate logic used in AI
torepresent knowledge?
Ans : Role of reasoning in AI.
Reasoning is a cognitive process that allows us to draw logical conclusions from given
information. In AI systems, reasoning is used to draw inferences from data and
knowledge. Reasoning is a key component of AI systems. It allows AI systems to make
deductions and inferences from data and knowledge.
The reasoning is essential so that the machine can also think rationally as a human
brain, and can perform like a human.
om
.c
Knowledge representation of predicate logic in A.I.
ty
si
er
First-order logic is another way of knowledge representation in artificial intelligence. It
iv
is an extension to propositional logic. FOL is sufficiently expressive to represent the
n
gu
natural language statements in a concise way. First
First-order logic is also known as
Predicate logic or First-order predicate logic.
in
er
-
ne
which
different from propositional logic which lacks quantifiers.
i
ng
re
2.
ha
bi
:
-
tree:
:
om
.c
n
re
Example of Bayesian Network
ha
bi
With the knowledge representation A is true
then B is true, but consider a situation where we are not sure about whether A is true or
not then we cannot express this statement, this situation is called uncertainty.
For example, if it is unknown whether or not it will rain tomorrow, then there is a state of
uncertainty. If probabilities are applied to the possible outcomes using weather forecasts or
even just a calibrated probability assessment, the uncertainty has been quantified.
om
.c
ty
In AI and expert systems, uncertainty is measured by using relative frequencies or by
si
combining various statistical models based on data and information collected from various
er
sources.. Some of these measures are objective in nature while others may be from
fr domain
iv
experts
n
gu
There are four methods of manage uncertainty in expert systems and artificial intelligence.
in
They are: 1) default or non-monotonic
monotonic logic, 2) probability, 3) fuzzy logic, 4) truth
truth-value as
er
evidential support, Bayesian theory, and 6) proba
probability reasoning.
ne
1) Default or non-monotonic
monotonic logic:
i
ng
Default logic is a non-monotonic
monotonic logic proposed by Raymond Reiter to formalize reasoning
re
ha
standard logic can only express that something is true or that something
bi
is false.
2) probability
Probabilistic reasoning is a way of knowledge representation where we apply the concept
of probability to indicate the uncertainty in knowledge. In probabilistic reasoning, we
combine probability theory with logic to handle the uncertainty.
Eg :
In a class, there are 70% of the students who like English and 40% of the students
who likes English and mathematics, and then what is the percent of students those who like
English also like mathematics?
Solution:
Let, A is an event that a student likes Mathematics
B is an event that a student likes English.
om
3) fuzzy logic : Fuzzy Logic (FL) is a method of reasoning that resembles human
.c
reasoning. The approach of FL imitates the way of decision making in humans that
ty
involves all intermediate possibilities between digital values YES and NO.
i
rs
ve
ni
h
bi
4.(a) What do you mean by learning? Explain briefly the
learning methods. Discuss the advantages and
disadvantages of rule based system.
Ans:- Learning :- Learning is the branch of Artificial Intelligence and
Computer Science which focus on the work of data and algorithm to imitate the
way that human beings learn , gradually improving its accuracy.
There are the following different methods of learning in AI.
1. Supervised Learning
2. Unsupervised Learning
3. Semi Supervised Learning
Supervised Learning :- Supervised learning, also known as supervised
om
machine learning, is a subcategory of machine learning and artificial
intelligence.
.c
ty
si
It is defined by its use of labeled datasets to train algorithms that to classify
data or predict outcomes accurately.
er
n iv
Supervised learning helps organizations solve for a variety of real-world
real
gu
problems at scale, such as classifying spam in a separate folder from your
inbox.
in
er
ne
Environment
i
ng
re
LA
ha
bi
Supervisor
Desired Output
Actual Output
Error
Unsupervised Learning :- Unsupervised learning, also known as unsupervised
machine learning, uses machine learning algorithms to analyze and cluster
unlabeled datasets.
These algorithms discover hidden patterns or data groupings without the need
for human intervention.
Its ability to discover similarities and differences in information make it the
ideal solution for exploratory data analysis, cross-selling strategies, customer
segmentation, and image recognition.
om
ENVIRONMENT
.c
ty
si
er
n iv
gu
in
er
ne
L.A
i
ng
Output
re
ha
bi
Semi Supervised Learning-: Semi-supervised machine
learning is a combination of supervised and unsupervised learning. It uses
a small amount of labeled data and a large amount of unlabeled data,
which provides the benefits of both unsupervised and supervised learning
while avoiding the challenges of finding a large amount of labeled data.
Advantages of Rule based System in AI
1. Cost Efficient
2. Stable Output
3. Low Error Rate
4. Less Risk
5. Instant Output
Dis-Advantages of System in AI
1. Manual Risk
2. Time Consuming Inputs
3. Low Self Learning Capacity
4. Difficult Pattern Identification
4.(b) Is Regression a supervised learning? Justify
your answer. Compare regression with classification
with example.
om
Ans:- Yes, regression is a type of supervised learning. Supervised learning is a
category of machine learning where the model learns from labeled training
.c
data. In supervised learning, the data consists of input features (independent
ty
si
variables) and corresponding target values (dependent variables). The goal is to
er
train a model that can predict the target values for new, unseen input data.
n iv
Regression specifically deals with predicting continuous numerical values. It
gu
aims to establish a relationship between the input features and the target
in
variable, allowing the model to make predictions or estimate the values of the
er
target variable based on the input data. The target variable in regression can
ne
be a real-valued number
ber or a continuous variable, such as predicting the price
i
ng
of a house based on its features or estimating the sales volume of a product
based on various factors.
re
ha
The training process in regression involves fitting a mathematical function or a
bi
model to the training data, optimizing it based on a specific criterion (such as
minimizing the sum of squared errors), and then using this trained model to
make predictions on new data.
Since regression requires labeled training data and falls under the umbrella of
supervised learning, it is considered a supervised learning technique.
Comparison between regression and classification with example:-
Example of Regression:- Let's consider the task of predicting the price of a
used car based on its features such as mileage, age, brand, and condition. By
training a regression model using historical data, the model learns the
relationship between these features and the actual prices of previously sold
cars. Once trained, the model can predict the price of a new, unseen car given
its features.
Example of Classification:- Let's consider the task of classifying emails as
"spam" or "not spam" based on their content and metadata. By training a
classification model using labeled emails, the model learns the patterns and
characteristics that distinguish spam emails from legitimate ones. Once
trained, the model can classify new, unseen emails as either spam or not spam
based on their features and the learned decision boundary.
In summary, regression is used to predict continuous numerical values, while
classification is used to assign data to predefined categories. Regression focuses
on estimating a value within a range, while classification focuses on assigning a
discrete label to data points.
om
.c
ty
si
er
n iv
gu
in
er
i ne
ng
re
ha
bi
5.(a) Draw
Ans:- A/Q, Sentence is given that john gave lecture to his students Let
agent = John ,
Action = gives
Object = Lecture
Receiver = his
student
Diagram of Semantic network of the given sentences are as follows:-
Lecture
Gives
Action
John Event W6
agent Object
receiver
Student
om
.c
ty
si
er
5.(b) What Is First Order Predicate Logic(FOPL)? Represent the
n iv
gu
opportunity to work on live project is Happy. But anyone who
in
studies sincerely or is Lucky can pass all his exams. Ramu did not
er
study but he is lucky. Anyone who is Lucky gets a
ne
gi
en
Ans:- First-Order
Order Predicate Logic (FOPL), also known as First
First-Order Logic
ar
(FOL) or First-Order
Order Predicate Calculus, is a formal system used for representing
and reasoning about statements in logic. FOPL includes predicates, variables,
quantifiers, and logical connectives to express relationships and properties.
Let's represent the given facts in FOPL:
Constants:
Passing(x): Represents that person x has passed his AI paper.
Working(x): Represents that person x has an opportunity to work on a liveproject.
Happy(x): Represents that person x is happy.
Studying(x): Represents that person x is studying.
Lucky(x): Represents that person x is lucky.
Exam(x): Represents that there is an exam x.
Ramu: Represents the person named Ramu.
Predicates:-
Has Opportunity(x): Represents that person x has an opportunity to work ona live
project.
Facts:-
1. "Anyone passing his AI paper and getting an opportunity to work on a
live happy." x (Passing(x) Happy(x))
2. "But anyone who studies sincerely or is lucky can pass all his exams."
x((Studying(x) ( y Exam(y) Passing(x)))
Or
3. "Ramu did not study but he is lucky." ¬Studying(Ramu) Lucky(Ramu)
4. a live project." x (Lucky(x)
om
HasOpportunity(x))
.c
ty
Expain the importance of an expert system. What are the
r si
various Knowledge representative techniques used in expert
ve
system?
ni
Ans:- Expert systems play a crucial role in AI and have several important
gu
applications. Here are some key reasons why expert systems are considered
rin
significant:
ee
in
1. Knowledge Representation: Expert systems provide a structured and
ng
organized approach to represent and store human expertise and
re
knowledge.
2. Decision Support: Expert systems can assist in complex decision-making
ha
decision
processes by emulating the decision
decision-making capabilities of human
bi
experts.
3. Scalability and Consistency: Expert systems can provide consistent and
reliable advice or solutions across different scenarios. They can handle
large amounts of complex data and perform computations efficiently.
consistently, leading to improved accuracy and reliability.
4. Knowledge Transfer: Expert systems facilitate the transfer of expertise
from experienced individuals to less-experienced or novice users. By
capturing and codifying the knowledge of domain experts, expert systems
make it accessible to a wider audience.
5. Reasoning and Explanation: Expert systems can provide explanations and
justification for their conclusions or recommendations. They can trace
their reasoning process and provide transparency, allowing users to
understand why a particular decision was made.
6. Continuous Learning and Improvement: Expert systems can be designed
to learn and adapt over time. By incorporating machine learning
techniques, expert systems can update their knowledge base based on
new data and experiences.
Overall, expert systems contribute to the field of AI by capturing and
leveraging human expertise, enabling efficient decision-making,
promoting knowledge sharing, and providing consistent and reliable
solutions in various domains.
There are several representative techniques used in expert systems to capture
om
and utilize expert knowledge. Here are some of the key techniques commonly
.c
employed:
ty
si
1. Rule-Based Systems: Rule-based
based systems are the most widely used
r
ve
technique in expert systems. They represent knowledge as a collection of
ni
"if-then"
then" rules. These rules encode the expert's knowledge and provide a
gu
set of conditions (if part) that, when satisfi
satisfied, trigger specific actions or
conclusions (then part).
rin
2. Case-Based
Based Reasoning: Case-based
Case -based reasoning (CBR) involves solving new
Case-
ee
problems by retrieving and reusing similar cases from a case library. It
in
captures knowledge in the form of past experiences or ccases. When faced
ng
with a new problem, the system searches for similar cases, adapts and
re
applies the solutions used in those cases, and provides a solution for the
ha
current problem
3. Fuzzy Logic Systems: Fuzzy logic deals with uncertainty and imprecise
bi
information by allowing degrees of membership to different categories.
Fuzzy logic-based expert systems use fuzzy rules and fuzzy sets to
represent and reason with uncertain or vague knowledge.
These techniques are often combined or integrated in expert systems to
leverage their respective strengths and address specific problem domains. The
choice of technique depends on the nature of the problem, the available
knowledge, and the specific requirements of the expert system.
6(b)What is Fuzzy Logic? Explain union and intersection
statement into Fuzzy Logic.
Ans:- Fuzzy logic is an approach to computing based on "degrees of
truth" rather than the usual "true or false" (1 or 0) Boolean logic on which
the modern computer is based.
Fuzzy Logic deals with qualitative information.
This is More realistic than predicarte calculus, because in real life we need to deal
with qualitative statements.
Examples:- It is very cold in himalyas.
om
Rich people have a lot of worries.
.c
Union Operation on Fuzzy set:- The Membership Function of the union of
ty
two fuzzy sets A and B is defined as the maximum of the two individual
r si
membership function. ve
ni
gu
Intersection Operation on Fuzzy set:- The Membership Function of the
intersection of two fuzzy sets A and B is defined as the minimum of the two
individual membership function.
7.Describe the following with suitable examples:
(a) Logistic Regression
(b) Back propagation algorithm
o Ans:- Logistic Regression:- Logistic regression is one of the most popular
Machine Learning algorithms, which comes under the Supervised Learning
technique. It is used for predicting the categorical dependent variable using a given
set of independent variables.
o Logistic regression predicts the output of a categorical dependent variable.
Therefore the outcome must be a categorical or discrete value. It can be either Yes
or No, 0 or 1, true or False, etc. but instead of giving the exact value as 0 and 1, it
om
gives the probabilistic values which lie between 0 and 1.
.c
Example:- Gaming is one of the best example for logistic regression.
ty
Speed is one of the advantages of logistic regression, and it is extremely useful in the
si
gaming industry. Speed is very important in a game. Very popular today are the games
r
where you can use in-game
game purchases to improve the gaming qualities of your
ve
character, or for fancy appearance and communication with other players. In In-game
ni
purchases are a good place to introduce a recommendatio
recommendation system.
gu
Tencent is the world's largest gaming company. It uses such systems to suggest gamers'
rin
equipment which they would like to buy. Their algorithm analyzes a very large amount
ee
of data about user behavior and gives suggestions about equipment a part
particular user
may want to acquire on the run. This algorithm is logistic regression.
in
ng
Algorithm:- Backpropagation is a key algorithm
Ans:- Back propagation Algorithm:
re
used in training neural networks. It allows the network to learn from examples
ha
and adjust its weights to minimize the difference between predicted and target
bi
outputs. Here's an overview of the backpropagation algorithm along with an
example:
1. Forward Pass:
Start by initializing the weights and biases of the neural network
randomly.
Feed the input example through the network and compute the
output.
Apply the activation function to the outputs of each neuron in the
network.
2. Calculate Error:
Compare the network's output with the target output to calculate
the error.
This is typically done using a loss function such as mean squared
error or cross-entropy loss.
3. Backward Pass:
Start from the output layer and propagate the error gradients
backward through the network.
Compute the gradient of the error with respect to the weights and
biases of each neuron.
Update the weights and biases using gradient descent or a variant
of it, adjusting them to reduce the error.
4. Repeat:
Repeat steps 1-3 3 for all training examples in the dataset.
om
Continue iterating through the dataset multiple times (epochs) to
further refine the network's weights.
.c
5. Evaluation:
ty
si
After training, use the trained network to make predictions on new,
r
unseen examples. ve
Evaluate the network's performance using appropriate metrics such
ni
as accuracy or precision/recall.
gu
rin
Example:
ee
Let's consider a simple example of training a neural network to perform binary
in
classification on a dataset of flower images. Assume the network has one input
ng
layer, one hidden layer with two neurons, and one output layer.
re
ha
1. Forward Pass:
bi
Input example: An image of a flower with features (peta
(petal length,
petal width).
Weights and biases: Randomly initialized values for the connections
between neurons.
Compute the output of the network using the weighted sum and
activation function.
2. Calculate Error:
Compare the network's output (predicted class probabilities) with
the target output (actual class label).
Calculate the error using a suitable loss function like cross-entropy.
3. Backward Pass:
Starting from the output layer, calculate the gradient of the error
with respect to the weights and biases.
Propagate the gradients backward to the hidden layer and calculate
their gradients.
Update the weights and biases using the gradients and a learning
rate to adjust them in the direction that reduces the error.
4. Repeat:
Repeat steps 1-3 for all flower images in the training dataset.
Iterate through the dataset multiple times (epochs) to refine the
network's weights.
5. Evaluation:
Once training is complete, use the trained network to predict the
class label (e.g., whether a flower is iris or not) for new, unseen
om
flower images.
Evaluate the network's performance using metrics like accuracy,
.c
precision, or recall.
ty
rsi
Backpropagation allows the neural network to iteratively adjust its weights
ve
based on the error calculated during training. By propagating the error
ni
gradients backward through the network, the algorithm enables the network to
gu
learn and improve its predictions over time.
rin
ee
8.(a) Express the following statements in propositional logic
logic:
in
i) Cancer will not be cured unless its cause is determined and a new
ng
drug for cancer is found.
re
ii) If the Humidity is high, it will rain either today or tomorrow.
ha
iii) it requires courage and skills to climb a mountain.
bi
Ans:- i) Ans:- Let Cancer will be cured = p.
Cause of cancer is determined = q.
New drug for Cancer is found=r.
~(q
Let the Humidity is high = A
It will rain today=B
It will rain tomorrow=C
A
Let It requires Courage = S
It requires Skills = T
Climb Mountain=U