Assignment #2 AI
Assignment #2 AI
FILE SUBMITTED TO
GIAN JYOTI INSTITUTE OF MANAGEMENT
&
TECHNOLOGY
PHASE-2, MOHALI
AFFILIATED TO
c. What is Bayesian reasoning? How does an expert system rank potentially true
hypotheses? Give an example.
Ans. Bayesian reasoning is a statistical method that calculates the probability of a hypothesis based on prior
knowledge and new evidence. An expert system uses Bayesian reasoning to rank potentially true
hypotheses by assigning probabilities to them based on their plausibility. For example, an expert system for
diagnosing diseases may assign higher probabilities to diseases that have similar symptoms to the patient's
symptoms and are more common in the patient's demographic group.
d. What are a fuzzy set and a Membership function? What is the difference between a crisp
set and a fuzzy set? Determine possible fuzzy sets on the universe of discourse for man
weights.
Ans. A fuzzy set is a set in which elements have degrees of membership, rather than a binary true/false
membership. A membership function is a mathematical function that assigns a degree of membership to
each element in the fuzzy set. The difference between a crisp set and a fuzzy set is that elements in a crisp
set have a binary true/false membership. Possible fuzzy sets on the universe of discourse for man weights
could include "light," "average," "heavy," each with a corresponding membership function.
e. Write down the steps of breadth first search. Illustrate with example.
Ans. Breadth first search is a search algorithm that explores all the vertices at the current depth level before
moving on to the next depth level. The steps of breadth first search are:
1. Start at the root node.
2. Visit all the neighboring nodes of the root node.
3. Add the neighboring nodes to the queue.
4. Move to the next node in the queue and repeat steps 2-3 until the goal node is found or the queue is
empty.
For example, in a graph with nodes A, B, C, D, E, and F, with edges connecting A to B, B to C and D, C to E, and
E to F, a breadth first search starting at node A would visit nodes B and D at level 1, nodes C and E at level 2,
and node F at level 3.
f. Explain the process of memory bounded heuristic search.
Ans. Memory bounded heuristic search is a search algorithm that limits the amount of memory used by the
search algorithm by discarding nodes that are unlikely to lead to the goal state. The algorithm uses a
heuristic function to evaluate the quality of the nodes and decides which nodes to keep in memory. This
approach can be useful in situations where memory is limited, such as in robotics or embedded systems.
h. Give a heuristic that a block-stacking program might use to solve problems of the form
“stack block X on block Y”.
Ans. A heuristic that a block-stacking program might use to solve problems of the form "stack block X on
block Y" could be to always choose the tallest block available that can be placed on the target block without
falling off. This heuristic would ensure
i. What is an expert system shell? What are the fundamental characteristics of an expert
system?
Ans. An expert system shell is a software system that provides a framework for building and implementing expert
systems. It contains the basic infrastructure for an expert system, including the inference engine, knowledge
representation, and user interface. The fundamental characteristics of an expert system include the ability to reason and
make decisions based on knowledge, the ability to explain its reasoning to the user, and the ability to learn and
improve its performance over time.
Q2. What are the different approaches in defining artificial intelligence? What
characteristics must a problem possess to be solved using artificial intelligence? Write a
description of 8-queens problem.
Ans. Different approaches to defining artificial intelligence:
There are several approaches to defining artificial intelligence, some of which are:
1. Thinking Humanly: This approach aims to understand how the human mind works and tries to create AI
systems that can think like humans.
2. Acting Humanly: This approach focuses on creating AI systems that can perform tasks that are typically
associated with human intelligence.
3. Thinking Rationally: This approach involves creating AI systems that can reason logically and make
decisions based on rational thinking.
4. Acting Rationally: This approach aims to create AI systems that can act in the most rational way possible,
given the available information.
To be solved using artificial intelligence, a problem must possess the following characteristics:
1. The problem must be well-defined.
2. The problem must be difficult or impossible to solve using traditional programming methods.
3. There must be enough data available to train the AI system.
8-Queens problem:
The 8-Queens problem is a classic problem in AI that involves placing 8 queens on a chessboard in such a
way that no two queens threaten each other. This means that no two queens should be placed on the same
row, column, or diagonal.
Q3. Discuss the syntax and semantics of prepositional logic. List the rules of inference for
propositional logic. Consider the following facts and construct a step-by-step proof by
resolution of the statement “John likes peanuts”. a. John likes all kinds of food. b. Apple and
vegetable are foods. c. Anything anyone eats and is not killed by is food. d. Anil eats peanuts
and is still alive. e. Harry eats everything that Anil eats.
Ans. Prepositional logic:
Prepositional logic is a type of logic that deals with propositions, which are statements that can either be
true or false. The syntax of prepositional logic involves the use of logical operators such as AND, OR, and
NOT, as well as variables that represent propositions. The semantics of prepositional logic involves
determining the truth value of a compound proposition based on the truth values of its component
propositions.
Rules of inference for propositional logic:
1. Modus Ponens: If p implies q, and p is true, then q must be true.
2. Modus Tollens: If p implies q, and q is false, then p must be false.
3. Hypothetical Syllogism: If p implies q, and q implies r, then p implies r.
Proof by resolution:
1. John likes all kinds of food. This can be represented as ∀x Likes(John, x).
2. Apple and vegetable are foods. This can be represented as Food(Apple) ∧ Food(Vegetable).
3. Anything anyone eats and is not killed by is food. This can be represented as ∀x ∀y Eats(x, y) ∧
NotKilledBy(y) → Food(y).
4. Anil eats peanuts and is still alive. This can be represented as Eats(Anil, Peanuts) ∧ NotKilledBy(Peanuts).
5. Harry eats everything that Anil eats. This can be represented as ∀x Eats(Anil, x) → Eats(Harry, x).
To prove that John likes peanuts, we can use resolution to derive the proposition Likes(John, Peanuts) from
the premises. The proof by resolution involves the following steps:
1. Convert all propositions into clauses.
2. Apply the resolution rule until a contradiction is reached or until no further resolution is possible.
3. If a contradiction is reached, the original proposition is true.
Q4. How are objects related in frame-based systems? What are the ‘a-kind-of’ and ‘a- part-
of’ relationships? Give examples.
QAns. Frame-based systems:
In a frame-based system, objects are represented as frames that contain slots, which represent various
attributes of the object. Objects can be related to each other through the "a-kind-of" and "a-part-of"
relationships.
The "a-kind-of" relationship represents a hierarchical relationship between objects, where one object is a
subtype of another object. For example, a car is a kind of vehicle.
The "a-part-of" relationship represents a relationship between objects where one object is a part of another
object. For example, an engine is a part of a car.
Q5. Differentiate between informed search and uninformed search. Explain depth first
search technique with example. Discuss the performance of this technique.
Ans. Informed search and uninformed search are two search strategies used in artificial intelligence.
Uninformed search algorithms are also known as blind search algorithms because they do not use any
domain-specific information to guide the search process. Depth-first search is an example of uninformed
search algorithm that explores a path to the deepest level of the search tree before backtracking. The
algorithm starts at the root node and explores as far as possible along each branch before backtracking.
For example, consider a search tree with three levels and three nodes in each level. The root node is labeled
A, and the child nodes are labeled B, C, and D. The second level nodes are labeled E, F, G, H, I, and J. The third
level nodes are labeled K, L, M, N, O, P, Q, R, S, T, U, and V. The search process of depth-first search starts at
the root node A, and it explores the path ABEGKL, then backtracks to node G and explores the path
GHMNRS, and finally backtracks to node S and explores the path SDFIJOPQTUV.
The performance of depth-first search depends on the branching factor and the depth of the tree. If the
branching factor is high and the depth of the tree is low, depth-first search can quickly find a solution.
However, if the branching factor is low and the depth of the tree is high, depth-first search can get stuck in a
path that leads to a dead end.
Q6. Explain the architecture of an expert system. What are rule based system architecture
and non-production system architecture?
Ans. The architecture of an expert system consists of three main components: a knowledge base, an
inference engine, and a user interface. The knowledge base contains the domain-specific knowledge that the
expert system uses to make decisions or solve problems. The inference engine uses reasoning and inference
techniques to manipulate the knowledge base and generate solutions or recommendations. The user
interface allows the user to interact with the expert system and provide input or receive output.
Rule-based system architecture is a type of expert system architecture that uses a set of rules to represent
knowledge. Each rule is a statement that describes a relationship between conditions and actions. The
conditions are evaluated, and if they are satisfied, the actions are performed. Non-production system
architecture is another type of expert system architecture that uses symbolic reasoning techniques to
represent knowledge. It uses a set of symbols and rules to manipulate them.
Q7. Write about the various tasks in natural language processing in detail. What are the
main difficulties in natural language understanding?
Ans. Natural language processing (NLP) is a field of artificial intelligence that focuses on the interaction
between humans and computers using natural language. NLP tasks include text classification, sentiment
analysis, named entity recognition, machine translation, and question answering. One of the main
difficulties in natural language understanding is the ambiguity of language. The same word can have
multiple meanings, and the same sentence can be interpreted in different ways depending on the context.
Another difficulty is the complexity of grammar and syntax. Natural languages have complex grammar rules,
and the syntax can vary greatly from language to language. Additionally, the use of idioms, slang, and
colloquialisms can pose a challenge for natural language processing. Finally, the lack of context and
background knowledge can also be a challenge for natural language understanding.