AI - (Sangida Akter) (ID-11608019) .

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Department

Of
Computer Science & Engineering
Assignment On
Course Code : CSE-4101
Course Title : Artificial Intelligence

Submitted to:
Chowdhury Shahriar Muzammel
Lecturer
Dept.of CSE
Comilla University

Submitted by:
SangidaAkter
ID :11608019
Session : 2015-16
Dept.of CSE
Comilla University

Submission Date: 02/10/2020


Question no: 1

(a) “AI lacks of creative responses that human experts are capable of”-is the statement
true. Justify your answer.

(b) Define the term Artificial Intelligence (AI).How can you organize the definitions of
Artificial Intelligence (AI) along two dimensions and into four categories?

(c) To what extend the following computer systems are the instances of AI:

i. Web search engines


ii. Voice activated telephone menus.

Answer to the Question Number-1

(a)

“AI lacks of human responses that human experts are capable of” – the given statement
is true.

AI or artificial intelligence is the study and design of computing systems that perceives
its environment and takes actions like human beings. Though AI has revolutionized in
many areas, but still it has not reach the human level of excellence. The lacking it has is
given below:

1. Algorithms: The algorithms used in AI cannot be generalized properly.


The results may differ in different environment. Supervised algorithm
needs human supervision. It needs to be programmed by human.
2. Adaption to new environment: Human experts can adapt to new
environment and create his new algorithm using his prior knowledge. AI
programs have difficulty adapting to new environment.
3. Perception: Human expert uses his five perceptions - sight, sound, touch,
taste and smell to gather information from the environment. Perception of
range and quality of AI is limited.
4. Human brain: Human brain has billions and billions of neuron working
simultaneously. Neural networks do not have the speed and efficiency of
human brain cells.

(b)

Artificial Intelligence (AI) : The study and design of computing systems that
perceives its environment and takes actions like human beings.

There are two ways in which AI is generally classified. One type is based on classifying
AI and AI-enabled machines based on their likeness to the human mind, and their
ability to “think” and perhaps even “feel” like humans. Another measurement is
rationality. A system is rational if it does the “right thing,” given what it knows.
According to this system of classification, there are four types of AI or AI-based
systems.

 Thinking humanly: Thinking humanly means trying to understand


and model how the human mind works. But another approach is to
model how we should think. Cognitive modeling. Systems should
solve problems the same way humans do. The exciting new effort to
make computers think machines with minds, in the full and literal
sense.
 Acting humanly: Acting humanly means acting like a person. The
classic example of this is the “Turing test”. The art of creating
machines that perform functions that require intelligence when
performed by people. Another definition is that, the study of how to
make computers do things at which, at the moment, people are better.
 Thinking rationally: Thinking rationally means i.e., modeling
thinking as a logical process, where conclusions are drawn based on
some type of symbolic logic.
 Acting Rationally: Acting rationally means acting so as to achieve
one's goals, given one's beliefs. An agent is just something that
perceives and acts. In the logical approach to AI, the emphasis is on
correct inferences. Rational agents that maximize the expected value
of their performance measure
 given what they currently know.
(c)

Web search engines:

These search engines retrieve pages using various techniques which might be
intelligent. For ex, auto correct feature that uses Data mining based on grasping the
user’s corrections of their own spelling errors. It may seems like a very big effort need
to be put up by humans, but with the processing powers of computers it is just way too
normal task. The intelligence required isn’t high though. Indexing huge amounts of
pages to get them in a fraction of a second is a problem in DB design and not Artificial
Intelligence.

The extent to which web search engine is an instance of an AI system is slightly


moderate when compared to Barcode scanner.

Voice-activated telephone menus:

Voice –activated telephone menus is similar to Web search engines. For ex: I say “OK
Google” and “Call XYZ“. The software is programmed to recognize the key words like
“OK google, Call” etc, and calls the XYZ person by looking up in the directory. If
phone-book has multiple entries then it asks us which contact to call. Voice recognition
is a part of AI systems but not completely AI. It’s almost predefined. It looks like AI but
it’s not. Same is the case with IVR options provided by telephone companies too.

The extent to which Voice-activated telephone menus is an instance of an AI system is


just moderate, slightly above Web search engines i.e moderate.
Question no: 2

(a) Define agent and rational agent. What are the things based on what rationality can
be defined?

(b) Describe the components to formularize a problem. Give standard formulation for
crossword puzzle problem.

(c) What are the criteria to evaluate an algorithm? Write short note on utility based
agent.

(d) Explain Depth-first search with suitable example.

Answer to the Question Number-2

(a)
 Agent: An agent is anything that can be viewed as perceiving its environment
through sensors & acting upon that environment through actuators.
 Rational Agent: For each possible percept sequence, a rational agent should
select an action that is expected to maximize its performance measure, given the
evidence provided by the percept sequence and whatever built-in knowledge the
agent has.
 There are four things which are defined Rationality:

 The performance measure that defines the criterion of success.


 The agent’s prior knowledge of the environment.
 The actions that the agent can perform.
 The agent’s percept sequence to date

(b)

The components to formulize a problem are given below:

 States
 Actions
 Goal test
 Path cost
 The standard formulization for crossword puzzled problem is
given below:

 State: An arrangement of n words on the puzzle.


 Initial Sate: No words on puzzle.
 Successor Function: Fill a word in the puzzle with one of the words in
dictionary.
 Goal: Fill all the words in the puzzle.
 Path Cost: Each fill cost 1
 Solution: Crossword puzzle construction can be solved many ways.
One simple choice is depth-first search.Each successor fills in a word
in the puzzle with one of the words in dictionary.It is better to go one
word at a time, to minimize the number of steps.

(c)
 The criteria to evaluate an algorithm are given below:
 Completeness
 Time
 Space
 Optimality
 There are a short description on Utility Based Agent:
 These agents are similar to the goal-based agent but provide an
extra component of utility measurement which makes them
different by providing a measure of success at a given state.
 Utility-based agent act based not only goals but also the best way to
achieve the goal.
 The Utility-based agent is useful when there are multiple possible
alternatives, and an agent has to choose in order to perform the best
action.
 The utility function maps each state to a real number to check how
efficiently each action achieves the goals.
Figure: Utility Based Agent
(d)
Below is explained Depth First Search with example:
 Depth-first search is a recursive algorithm for traversing a tree or graph data
structure.
 It is called the depth-first search because it starts from the root node and
follows each path to its greatest depth node before moving to the next path.
 DFS uses a stack data structure for its implementation.

Example:
In the below search tree, we have shown the flow of depth-first search, and it will
follow the order as:

Root node--->Left node ----> right node.

It will start searching from root node S, and traverse A, then B, then D and E, after
traversing E, it will backtrack the tree as E has no other successor and still goal node is
not found. After backtracking it will traverse node C and then G, and here it will
terminate as it found goal node
Figure: Depth First Search
Completeness: DFS search algorithm is complete within finite state space as it will
expand every node within a limited search tree.

Time Complexity: Time complexity of DFS will be equivalent to the node traversed by
the algorithm. It is given by:

T(n)= 1+ n2+ n3 +.........+ nm=O(nm)

Where, m= maximum depth of any node and this can be much larger than d
(Shallowest solution depth)

Space Complexity: DFS algorithm needs to store only single path from the root node,
hence space complexity of DFS is equivalent to the size of the fringe set, which is
O(bm).

Optimal: DFS search algorithm is non-optimal, as it may generate a large number of


steps or high cost to reach to the goal node.
Question no: 4

(a) How does Greedy Best First Search work? Does Greedy Best First Search always
guarantee to find the optimal solution?-Justify with your own words.

(b) What are the problems of Hill-climbing search? How to deal these problems? Explain
with necessary figure.

(c) Consider a tree having b=3,d=2.Now prove that DFS has Max-list-length : 1+d(b-1).

Answer to the Question Number-4

(a)
Greedy Best First Search:

Greedy best-first search algorithm always selects the path which appears best at that
moment. It is the combination of depth-first search and breadth-first search algorithms.
It uses the heuristic function and search. Best-first search allows us to take the
advantages of both algorithms. With the help of best-first search, at each step, we can
choose the most promising node. In the best first search algorithm, we expand the node
which is closest to the goal node and the closest cost is estimated by heuristic function,
i.e.

f(n) = g(n).

Were, h(n) = estimated cost from node n to the goal.

The greedy best first algorithm is implemented by the priority queue.

Working process of Greedy Best First Search:

 Step 1: Place the starting node into the OPEN list.


 Step 2: If the OPEN list is empty, Stop and return failure.
 Step 3: Remove the node n, from the OPEN list which has the lowest value of
h(n), and places it in the CLOSED list.
 Step 4: Expand the node n, and generate the successors of node n.
 Step 5: Check each successor of node n, and find whether any node is a goal
node or not. If any successor node is goal node, then return success and
terminate the search, else proceed to Step 6.
 Step 6: For each successor node, algorithm checks for evaluation functionf(n),
and then check if the node has been in either OPEN or CLOSED list. If the node
has not been in both list, then add it to the OPEN list.
 Step 7: Return to Step 2.

Example:
Consider the below search problem, and we will traverse it using greedy best-first
search. At each iteration, each node is expanded using evaluation function f(n)=h(n) ,
which is given in the below table.

.
In this search example, we are using two lists which are OPEN and CLOSED Lists.
Following are the iteration for traversing the above example:
Figure: Greedy Best First Search

Expand the nodes of S and put in the CLOSED list

Initialization: Open [A, B], Closed [S]

Iteration 1: Open [A], Closed [S, B]

Iteration 2: Open [E, F, A], Closed [S, B]


: Open [E, A], Closed [S, B, F]

Iteration 3: Open [I, G, E, A], Closed [S, B, F]


: Open [I, E, A], Closed [S, B, F, G]

Hence the final solution path will be: S----> B----->F----> G

Time Complexity: The worst case time complexity of Greedy best first search is O(bm).

Space Complexity: The worst case space complexity of Greedy best first search is
O(bm).Where, m is the maximum depth of the search space.

Complete: Greedy best-first search is also incomplete, even if the given state space is
finite.

Optimal: Greedy best first search algorithm is not optimal.


From above the criteria for evaluating the algorithm we call the Greedy Best First
Search algorithm does not always give the optimal solution .

(b)

Hill climbing algorithm is a local search algorithm which continuously moves in the
direction of increasing elevation/value to find the peak of the mountain or best solution
to the problem. It terminates when it reaches a peak value where no neighbor has a
higher value. It is a technique which is used for optimizing the mathematical problems.
One of the widely discussed examples of Hill climbing algorithm is Traveling-salesman
Problem in which we need to minimize the distance traveled by the salesman. It is also
called greedy local search as it only looks to its good immediate neighbor state and not
beyond that. A node of hill climbing algorithm has two components which are state and
value. Hill Climbing is mostly used when a good heuristic is available. In this
algorithm, we don't need to maintain and handle the search tree or graph as it only
keeps a single current state.

Problems in Hill Climbing Algorithm:

1. Local Maximum: A local maximum is a peak state in the landscape which is better
than each of its neighboring states, but there is another state also present which is
higher than the local maximum.

Solution: Backtracking technique can be a solution of the local maximum in state space
landscape. Create a list of the promising path so that the algorithm can backtrack the
search space and explore other paths as well.

2. Plateau: A plateau is the flat area of the search space in which all the neighbor states
of the current state contains the same value, because of this algorithm does not find any
best direction to move. A hill-climbing search might be lost in the plateau area.
Solution: The solution for the plateau is to take big steps or very little steps while
searching, to solve the problem. Randomly select a state which is far away from the
current state so it is possible that the algorithm could find non-plateau region.

3. Ridges: A ridge is a special form of the local maximum. It has an area which is higher
than its surrounding areas, but itself has a slope, and cannot be reached in a single
move.

Solution: With the use of bidirectional search, or by moving in different directions, we


can improve this problem.

(c)

Depth-first Search

Depth-first search is a recursive algorithm for traversing a tree or graph data


structure. It is called the depth-first search because it starts from the root node
and follows each path to its greatest depth node before moving to the next path.
DFS uses a stack data structure for its implementation. The process of the DFS
algorithm is similar to the BFS algorithm.

Considering a tree having b=3, d=2.Now applying in DFS:


i

n1 n2
n3

n12 n23 n31 n32 n33


n11 n13 n21 n22

Visited List

i n1 n2 n3

n1 n11 n12 n13 n2 n3

n11 n12 n13 n2 n3

n12 n13 n2 n3

n13 n2 n3

n2 n21 n22 n23 n3

n21 n22 n23 n3

n22 n23 n3
Visited List

n23 n3

n3 n31 n32 n33

n31 n32 n33

n32 n33

n33 empty

So, The Maximum list length we get=1+ d(b-1) [Proved]


Question no-8

(a) Define Unification. Unify these two expressions : (1) P(x, f(y)) , (2) P(a, f(g(z)))
(b) Given facts:
i. All people who are graduating are happy.
ii. All happy people smile.
iii. Someone is graduating.

By using Resolution prove that, Someone is smiling.

(c) Translate the following sentences into Predicate Logic:


i. All Pompeian's were Roman.
ii. Caesar was a ruler.
iii. All Romans were either loyal to Caesar or hated him
iv. Everyone is loyal to someone.
v. People only try to assassinate rulers they are not loyal to

Answer to the Question Number-8

(a)

Unification:

Unification is the algorithmic procedure used in solving equations involving


symbolic expressions. In other words, by replacing certain sub-expression variables
with other expressions, unification tries to identify two symbolic expressions.

Below examples are solved using unification algorithm:

P(x, f(y)) --------------------(1)

P(a, f(g(z))) -----------------(2)

 Unification is all about making the expressions look identical. So for the both
above expressions to make them look identical we need to be substitution.
 Formal notation for substitution we still use substitution x with a in expression
(1), So it is represented as a for x, i.e a/x and also g(z)/y.
 With both the substitution we can make expression (1) look like expression(2).
We get, [a/x, g(z)/y]

(b)

Proof by Resolution that “Someone is smiling”

Facts:

i. All people who are graduating are happy.


ii. All happy people smile.
iii. Someone is graduating.

Step-1:

i. ∀x : Grade(x)-----happy(x)
ii. ∀x : happy(x)-----smile(x)
iii. ∃x : Grade(x)
iv. ∃x : smile(x)

Step-2:

a)

i. ∀x : ¬ Grade(x) ∨ happy(x)
ii. ∀x : ¬happy(x) ∨ smile(x)
iii. ∃x : Grade(x)
iv. ∃x : smile(x)

b)
i. ∀x : ¬ Grade(x) ∨ happy(x)
i. ∀y : happy(y) ∨ smile(y)
ii. ∃z : Grade(z)
iii. ∃x : smile(w)

c)

i. ∀x : ¬ Grade(x) ∨ happy(x)
ii. ∀y : ¬happy(y) ∨ smile(y)
iii. ∃x : Grade(A)
iv. ∃x : smile(V)

d)

i. ¬ Grade(x) ∨ happy(x)
ii. ¬happy(y) ∨ smile(y)
iii. Grade(A)
iv. smile(V)

Step-3: ¬ smile(V)

Step-4: ¬ smile(V)

y/V (2) ¬happy(y) ∨ smile(y)

¬happy(y)

x/V (1) ¬ Grade(x) ∨ happy(x)

¬ Grade(V)

h/V (3) ¬ Grade(A)

Hence. Someone is smiling.

(c)
i. All Pompeian's were Roman: ∀x: Pompeian(x)→ Roman (x)
ii. Caesar was a ruler: ruler (Caesar)
iii. All Romans were either loyal to Caesar or hated him: ∀x : Roman (x)→ loyal to (x,
Caesar) ∨ hate (x, Caesar)
iv. Everyone is loyal to someone: ∀x ∃y: loyal to (x, y)
v. People only try to assassinate rulers they are not loyal to: ∀x ∃y: Person (x) ∧ ruler
(y) ∧ tryassassinate(x, y)→ ¬ loyalto(x, y)
Question no-7

(a)Define artificial neural network. Briefly describe different layers of ANN with
appropriate figure.

(b)Explain supervised learning with appropriate diagram.

(c)Define entailment, Distinguish between valid, satisfiable and unsatisfiable sentence.

Answer to the Question Number – 7

(a)
Artificial neuron network: An artificial neuron network (ANN) is a computational
model based on the structure and functions of biological neural networks.

Dr. Robert Hecht-Nielsen defines a neural network as:“...a computing system made up
of a number of simple, highly interconnected processing elements, which process
information by their dynamic state response to external inputs.”

Information that flows through the network affects the structure of the ANN because a
neural network changes - or learns, in a sense - based on that input and output. It is like
an artificial human nervous system for receiving, processing, and transmitting
information in terms of Computer Science.

ANNs are considered nonlinear statistical data modeling tools where the complex
relationships between inputs and outputs are modeled or patterns are found. The
inventor of one of the first neurocomputers.

There are 3 different layers in a neural network. They are:

1. Input Layer

2. Hidden Layers

3. Output Layer
Figure .Artificial neural network
1) Input layer: The Input layer communicates with the external environment that
presents a pattern to the neural network. Its job is to deal with all the inputs only. This
input gets transferred to the hidden layers which are explained below. The input layer
should represent the condition for which we are training the neural network. Every
input neuron should represent some independent variable that has an influence over
the output of the neural network

2) Hidden layer: The hidden layer is the collection of neurons which has activation
function applied on it and it is an intermediate layer found between the input layer and
the output layer. Its job is to process the inputs obtained by its previous layer. So it is
the layer which is responsible extracting the required features from the input data.
Many researches has been made in evaluating the number of neurons in the hidden
layer but still none of them was successful in finding the accurate result. Also there can
be multiple hidden layers in a Neural Network.

3) Output layer: The output layer of the neural network collects and transmits the
information accordingly in way it has been designed to give. The pattern presented by
the output layer can be directly traced back to the input layer. The number of neurons
in output layer should be directly related to the type of work that the neural network
was performing. To determine the number of neurons in the output layer, first consider
the intended use of the neural network.
Figure : Activation function for ANN
(b)
Supervised learning with appropriate figure is given below:

Supervised learning, in the context of artificial intelligence (AI) and machine learning, is
a type of system in which both input and desired output data are provided. Input and
output data are labelled for classification to provide a learning basis for future data
processing.

Supervised machine learning systems provide the learning algorithms with known
quantities to support future judgments. Chatbots, self-driving cars, facial recognition
programs, expert systems and robots are among the systems that may use either
supervised or unsupervised learning. Supervised learning systems are mostly
associated with retrieval-based AI but they may also be capable of using a generative
learning model.

Figure : Supervised learning


Training data for supervised learning includes a set of examples with paired input
subjects and desired output (which is also referred to as the supervisory signal). In
supervised learning for image processing, for example, an AI system might be provided
with labelled pictures of vehicles in categories such as cars and trucks. After a sufficient
amount of observation, the system should be able to distinguish between and categorize
unlabeled images, at which time training can be said to be complete.

Supervised learning models have some advantages over the unsupervised approach,
but they also have limitations. The systems are more likely to make judgments that
humans can relate to, for example, because humans have provided the basis for
decisions. However, in the case of a retrieval-based method, supervised learning
systems have trouble dealing with new information. If a system with categories for cars
and trucks is presented with a bicycle, for example, it would have to be incorrectly
lumped in one category or the other. If the AI system was generative, however, it may
not know what the bicycle is but would be able to recognize it as belonging to a
separate category.
(c)

Entailment: Entailment means that one thing follows from another. Entailment is a
relationship between sentences that is based on semantics.

The formula of entailment is:

KB ╞ α

Where,

KB=knowledge base

α is a sentence

Knowledge base (KB) entails sentence α if and only if α is true in all worlds where
KB is true

Example of entailment:

i. the KB containing “the Giants won” and “the Reds won” entails “Either the
Giants won or the Reds won”
ii. x+y = 4 entails 4 = x+y

Distinguishment among valid, satisfiable and unsatisfiable sentence:


1. Definition
a. A sentence is valid if it is true in all models
b. A sentence is satisfiable if it is true in some model
c. A sentence is unsatisfiable if it is true in no models
2. Example
a. Valid sentences: True, A A, A  A,
(A  (A  B))  B
b. Satisfiable sentence: A B, C
c. Unsatisfiable sentence: AA
3. Theorem
a. Validity is connected to inference via the Deduction Theorem: KB ╞ α if
and only if (KB  α) is valid
b. Satisfiability is connected to inference via the following:
KB ╞ α if and only if (KB α) is unsatisfiable

You might also like