Professional Documents
Culture Documents
Ayna
Ayna
(AI)
CHAPTER -1-
Introduction to Artificial Intelligence
AI – General:
• Let’s see the following:
How do we
create
What is intelligence?
intelligence?
Goals of AI:
• To make computers more useful by letting them take over dangerous or tedious
tasks from human.
• These processes include learning (the acquisition of information and rules for
using the information), reasoning (using rules to reach approximate or definite
conclusions) and self-correction.
• The definitions on TOP are concerned with thought processes and reasoning,
whereas the ones on the BOTTOM address behaviour.
Fig. 1.1. Some definitions of artificial intelligence, organized into four categories .
o Game Playing – they use heuristic knowledge of possible positions like chess, tic-tac-
toe, etc.
o Spam Fighting – classify over a billion messages as spam using learning algorithms.
o Machine Vision – systems understand, interpret, and comprehend visual input on the
computer.
CHAPTER -2-
Intelligent Agents
Introduction:
• We begin by examining agents, environments, and the coupling between them.
• How well an agent can behave depends on the nature of the environment; some
environments are more difficult than others.
Fig. 2.1. Agents interact with environments through sensors and actuators.
3/16/2021 AI @ IT- by Ayana O. Kitil 23
Agents and Environments, Cont. …(2)
• A human agent has eyes, ears, and other organs for sensors and hands, legs,
vocal tract, and so on for actuators.
• A robotic agent might have cameras and infrared range finders for sensors and
various motors for actuators.
• The term percept to refer to the agent’s perceptual inputs at any given instant.
• An agent’s percept sequence is the complete history of everything the agent has
ever perceived.
• An agent’s behaviour is described by the agent function that maps any given
percept sequence to an action.
• The vacuum agent perceives which square it is in and whether there is dirt in the square.
• It can choose to move left, move right, suck up the dirt, or do nothing.
• One very simple agent function is the following: if the current square is dirty, then suck;
otherwise, move to the other square.
3/16/2021 AI @ IT- by Ayana O. Kitil 25
Agents and Environments, Cont. …(4)
• A partial tabulation of this agent function is shown in figure below.
Fig. 2.3. Partial tabulation of a simple agent function for the vacuum-cleaner world shown in fig. 2.2.
Fig. 2.4. PEAS description of the task environment for an automated taxi.
3/16/2021 AI @ IT- by Ayana O. Kitil 28
Nature of Environments, Cont. …(2)
b. Properties of Task Environment:
o Fully Observable vs. Partially Observable – Example: Vacuum Agent vs. Taxi
Driving
o Single Agent vs. Multi-agent- Example: Crossword Puzzle vs. Chess
What did you think is a Taxi Driving?
The word “stochastic” generally implies that uncertainty about outcomes is quantified in
terms of probabilities;
3/16/2021 AI @ IT- by Ayana O. Kitil 29
Nature of Environments, Cont. …(3)
o Episodic vs. Sequential – Example: Music vs. Chess, Taxi Driving
o Static vs. Dynamic – Example: Crossword Puzzle vs. Taxi Driving
o Discrete vs. Continuous – Example: Chess vs. Taxi Driving
o Known vs. Unknown – Example: Solitaire Card Game vs. Video Game
• The job of AI is to design an agent program that implements the agent function -
the mapping from precepts' to actions.
• Agent Programs takes the current percept as input from the sensors, while the
agent function, which takes the entire percept history and return an action to the
actuators.
5. Learning Agent:
• These agents select actions on the basis of the current percept, ignoring the rest of
the percept history.
Fig. 2.5. The agent program for a simple reflex agent in the two-state vacuum environment.
3/16/2021 AI @ IT- by Ayana O. Kitil 33
1. Simple Reflex Agent, Cont. …(2)
• Example--2: Taxi Driver
Fig. 2.11 Three ways to represent states and the transitions between them.
2. For each of the following activities, give a PEAS description of the task
environment and characterize it in terms of the properties.
a. Shopping for used AI books from Internet.
CHAPTER -3-
• The search algorithms used in this chapter to solve problems are uninformed
search algorithms - algorithms that are given no information about the problem
other than its definition and an informed search algorithm can do quite well
given some guidance on where to look for solutions.
o The step cost of taking action a in state s to reach state sꞌ is denoted by c(s, a, sꞌ).
o We assume that step costs are non-negative.
• Therefore, the shortest path cost to reach the goal is 140 + 80 + 97 + 101 = 418.
• A solution to a problem is an action sequence that leads from the initial state to a goal state.
• Solution quality is measured by the path cost function, and an optimal solution has the
lowest path cost among all solutions.
3/16/2021 AI @ IT- by Ayana O. Kitil 50
3.2. Problem-Solving by Searching, Cont. …(7)
2. Example – Search Problems [Toy Problem]
o The 8-Queens problem. The goal of this is to place eight queens on a chessboard such
that no queen attacks any other. (A queen attacks any piece in the same row, column or
diagonal.)
• The basic structures that all search algorithms share primarily according to how
they choose which state to expand next.
EXERCISE:
•Apply the uninformed search strategy on the Romania map as per you understand!
oHint:
Change the graph into tree.
Use the concepts of frontier [Open List] and explored set [Closed List].
Consider the goal state is Bucharest.
3/16/2021 AI @ IT- by Ayana O. Kitil 56
3.2. Problem-Solving by Searching, Cont. …(13)
B. Informed Search Strategy
o It is also called Heuristic Search.
o It uses problem-specific knowledge beyond the definition of the problem itself - can find
solutions more efficiently.
o Therefore, the best path to arrive to the goal with an actual cost = “7”.
• It is a problem solved when each variable has a value that satisfies all the
constraints on the variable.
• Each domain Di consists of a set of allowable values, {v1, . . ., vk} for variable Xi.
• To solve a CSP, we need to define a state space and the notion of a solution.
• Each state in a CSP is defined by an assignment of values to some or all of the variables,
{Xi = vi, Xj = vj, . . .}.
• An assignment that does not violate any constraints is called a consistent or legal
assignment.
• A partial assignment is one that assigns values to only some of the variables.
3/16/2021 AI @ IT- by Ayana O. Kitil 62
3.4. Constraint Satisfaction Problem (CSP), Cont. …(3)
• Example – Crypt-arithmetic, N-Queen, Crossword Puzzle, Map Colouring, Latin
Square, and Sudoku.
Map Colouring Problem:
• Suppose that at a map of Australia showing each of its states and territories shown
in the Fig. below (a).
2. By using the following figure, answer the questions below with a neat and clear step.
CHAPTER -4-
Knowledge and Reasoning in AI
4.1. Introduction
• Humans, it seems, know things; and what they know helps them do things.
• These are not empty statements.
• They make strong claims about how the intelligence of humans is achieved not by
purely reflex mechanisms but by processes of reasoning that operate on internal
representations of knowledge.
• It is called knowledge-based agents.
• Knowledge-base is where knowledge were stored.
• Knowledge-based system is a system which is built around a knowledge base,
i.e. a collection of knowledge, taken from a human, and stored in such a way that
the system can reason with it.
3/16/2021 AI @ IT- by Ayana O. Kitil 69
4.2. Knowledge-Based Agents
• The central component of a knowledge-based agent is its knowledge base, or KB.
• Sometimes we dignify a sentence with the name axiom, when the sentence is
taken as given without being derived from other sentences.
• There must be a way to add new sentences to the knowledge base and a way to
query what is known.
• The standard names for these operations are TELL and ASK, respectively.
3/16/2021 AI @ IT- by Ayana O. Kitil 70
4.2. Knowledge-Based Agents, Cont. …(2)
• Both operations may involve inference - that is, deriving new sentences from old.
• Inference must obey the requirement that when one ASKs a question of the
knowledge base, the answer should follow from what has been told (or TELLed)
to the knowledge base previously.
• The details of the inference mechanisms are hidden inside TELL and ASK.
Knowledge-Engineer:
o Helps the expert(s) structure the problem area by interpreting and integrating human
answers to questions, drawing analogies, and bringing to light conceptual difficulties.
o Usually also called System Builder.
o It translates the knowledge into computer understandable language.
o It designs an inference engine, a reasoning structure, which can use knowledge when
needed.
3/16/2021 AI @ IT- by Ayana O. Kitil 76
4.3. Expert System, Cont. …(4)
• There are three components of expert system.
a. Knowledge Base
o It represents all the data and information imputed by experts in the field.
o Also, it is an information inside the expert system represented as a series of IF-THEN
statements.
o It is a database that holds specific information and rules about a certain subject.
o It is a collection of objects and their attributes.
o Knowledge – is the sort of information that people use to solve problems.
i. Factual KN – is the information widely accepted by the knowledge engineers and scholars
in the task domain.
ii. Heuristic KN – is about practice, accurate judgement, one’s ability of evaluation, and
guessing.
• It addresses the question of what content to put into an agent’s knowledge base –
how to represent facts about the world.
Solution: Starting from A, A is true then Solution: Starting from D, let D is true
B is true (A→B) then C is true (C→D).
B is true then C is True (B→C) C is true then B is True (B→C).
C is True then D is true proved (C→D). B is True then A is true Proved (A→B)
3. By Resolution Rule
A V B, ¬B V C
AV C
3/16/2021 AI @ IT- by Ayana O. Kitil 83
4.4.2. Propositional Logic
• Proposition is a statement of a fact which is either TRUE or FALSE.
• Example:
o Lucky is an honest boy. → True/False?
o 4*5+2 = 30. → True/False?
o Today is Monday. → True/False?
• In this, syntax and semantics - the way in which the truth of sentences is determined.
• An entailment - the relation between a sentence and another sentence that follows from it.
3/16/2021 AI @ IT- by Ayana O. Kitil 84
4.4.2. Propositional Logic, Cont. …(2)
A. Syntax:
o It defines the allowable sentences.
o The atomic sentences consist of a single proposition symbol.
o Each such symbol stands for a proposition that can be true or false.
o We use symbols that start with an uppercase letter and may contain other letters.
o Example:
P, Q, R, W and North.
o Complex sentences are constructed from simpler sentences, using parentheses and
logical connectives.
o There are five connectives in common use:
If the sentences in the knowledge base make use of the proposition symbols P, Q, and R, then
one possible model is 𝑚1 = {𝑃 = 𝑓𝑎𝑙𝑠𝑒,𝑄 = 𝑓𝑎𝑙𝑠𝑒,𝑅 = 𝑡𝑟𝑢𝑒}.
o With three proposition symbols, there are 23 = 8 possible models. This is done
recursively.
o Example:
The sentence ¬P ∧ (Q ∨ R), evaluated in m1, gives true ∧ (false ∨ true) = true ∧ true = true.
3/16/2021 AI @ IT- by Ayana O. Kitil 87
4.4.3. First-Order Logic (FOL) or Predicate Logic
• It is an extension of propositional logic.
• The language of FOL is built around objects, relations and functions.
• It can also express facts about some or all of the objects in the universe.
• When we look at the syntax of natural language, the world contains:
o Nouns and noun-phrases are referred to as objects such as squares, pits, Wumpus’s, House, …
o Verbs and verb-phrases that refer to relations.
Unary relations or properties such as red, round, bogus, prime, multi-storeyed, . . .
N-ary relations such as brother of, bigger than, inside, part of, has colour, occurred after, owns,
comes between, . . .
o Some of these relations are functions - relations in which there is only one “value” for a
given “input” like father of, best friend, third inning of, one more than, beginning of , …
Fig. 4.3. Formal languages and their ontological and epistemological commitments.
• Each predicate and function symbol come with an arity that fixes the number of
arguments.
3/16/2021 AI @ IT- by Ayana O. Kitil 92
4.4.3. FOL, Cont. … (6)
c. Terms:
o It is a logical expression that refers to an object.
o Example:
“King John’s left leg” rather than giving a name to his leg.
This is what function symbols are for: instead of using a constant symbol, we use
leftleg(john).
d. Atomic Sentences:
o It is a combination of terms and predicate that state facts.
o Example:
brother (richard, john). This states that “Richard is the brother of John.”
f. Quantifiers:
o It is a way of expressing properties of entire or some collections of objects.
o First-order logic contains two standard quantifiers.
o Example:
“King John has a crown on his head”, we write ∃ x crown(x) ∧ onhead (x, john).
∃x is pronounced “There exists an x such that . . .” or “For some x . . .”.
• Example:
Fig. 4.4. A fragment of a semantic network showing the representation of the logical assertion
Fly(Shankar, NewYork, NewDelhi, Yesterday).
3/16/2021 AI @ IT- by Ayana O. Kitil 97
Discussion – Quiz:
1. AI is a magic. [True/False]. If False, why? If True, how?
2. Is AI omniscience or autonomy?
5. List at least 5 AI devices familiar to you. Did you think that they are expert
system?
CHAPTER -5-
Learning in AI
5.1. Introduction
• Learning denotes changes in a system that enable a system to do the same task
more efficiently the next time, by Herbert Simon.
• Machine learning is the subfield of computer science, that gives computers the
ability to learn without being explicitly programmed, by Arthur Samuel.
• A computer program is said to learn from experience 'E' with respect to some
class of tasks 'T' and performance measure 'P', if its performance at tasks in 'T', as
measured by 'P', improves with experience 'E', by Mitchell, in 1997.
• The main purpose of machine learning is to study and design the algorithms that
can be used to produce the predicates from the given dataset.
• Learning can range from the trivial, as exhibited by jotting down a phone
number, to the profound, as exhibited by Albert Einstein, who inferred a new
theory of the universe.
• If the design of the agent can be improved, why wouldn’t the designers just
program in that improvement to begin with?
3/16/2021 AI @ IT- by Ayana O. Kitil 103
5.2. Learning from Example, Cont. …(2)
Forms of Learning:
• The improvements, and the techniques used to make them, depend on four major
factors:
a) Which component is to be improved?
b) What prior knowledge the agent already has?
c) What representation is used for the data and the component?
d) What feedback is available to learn from?
3. Prior Knowledge
o Learning a general function or rule from specific input–output pairs is called inductive
learning, whereas analytical or deductive learning going from a known general rule to
a new rule that is logically entailed.
b. Reinforcement Learning:
o The agent learns from a series of reinforcements – rewards or punishments.
o Suppose the lack of a tip at the end of the journey gives the taxi agent an indication
that it did something wrong.
o The two points for a win at the end of a chess game tells the agent it did something
right.
o Example – Game Playing.
3/16/2021 AI @ IT- by Ayana O. Kitil 108
5.2. Learning from Example, Cont. …(7)
c. Supervised Learning:
o The agent observes some example input–output pairs and learns a function that maps
from input to output.
o It involves learning with some supervision from external source, (i.e., a teacher).
In Componet-1 above, the inputs are percepts and the output are provided by a teacher who
says “Brake!” or “Turn left.”
In Componet-2, the inputs are camera images and the outputs again come from a teacher who
says “that’s a bus.”
In Component-3, the theory of braking is a function from states and braking actions to
stopping distance in feet. In this case the environment is the teacher.
o Example – Classification, Regression, etc.
ANN:
o It is modelled after brain.
o It is usually a computational network based on biological neural networks that
construct the structure of the human brain.
o It is designed by programming computers to behave simply like interconnected brain cells.
o It is also called connectionism, parallel distributed processing, and neural computation.
o Similar to a human brain has neurons interconnected to each other, ANN also have
neurons that are linked to each other in various layers of the networks. These neurons
are known as nodes.
o The activation function refers to the set of transfer functions used to achieve the
desired output.
o Threshold (t)– it is a point that used to determine activation or deactivation of neurons.
Example – if > 0 → 1 and -1 otherwise.
Input Function
1. A Feed-forward Network:
o It has connections only in one direction – i.e. , it forms a directed acyclic graph.
o Every node receives input from “upstream” nodes and delivers output to
“downstream” nodes.
o There are no loops.
o It
represents a function of its current input; thus, it has no internal state other than the
weights themselves.
Fig. 5.5. A perceptron network with two inputs and two output units.
3/16/2021 AI @ IT- by Ayana O. Kitil 120
5.3. ANN, Cont. …(12)
a
CHAPTER -6-
Communicating, Perceiving and Acting in AI
6.1. Introduction
• There are two main reasons why we want our computer agents to be able to
process natural languages:
1. To communicate with humans, &
2. To acquire information from written language.
• There are over a trillion pages of information on the Web, almost all of it in
natural language.
Text Classification:
• It is also known as categorization - given a text of some kind, decide which of a
predefined set of classes it belongs to.
3/16/2021 AI @ IT- by Ayana O. Kitil 129
6.2. NLP, Cont. …(2)
• Example:
o Language identification and genre classification, as is sentiment analysis (classifying a
movie or product review as positive or negative) and spam detection (classifying an
email message as spam or not-spam).
o Since “not-spam” is awkward, researchers have coined the term ham for not-spam.
o A training set is readily available: the positive (spam) examples are in my spam folder,
the negative (ham) examples are in my inbox.
• Most animals use signs to represent important messages: food here, predator
nearby, approach, withdraw, let’s mate.
• Humans are the most-chatty of all species, and if computer agents are to be
helpful, they’ll need to learn to speak the language.
3/16/2021 AI @ IT- by Ayana O. Kitil 131
6.4. Perception
• Perception provides agents with information about the world they inhabit by
interpreting the response of sensors.
• A sensor measures some aspect of the environment in a form that can be used as
input by an agent program.
o It could be as simple as a switch, or as complex as the eye.
b. A rendering model describes the physical, geometric, and statistical processes that produce
the stimulus from the world.
It is quite accurate, but they are ambiguous.
o Example:
A white object under low light may appear as the same colour as a black object under intense light.
A small nearby object may look the same as a large distant object.
Without additional evidence, we cannot tell if the image that fills the frame is a toy Godzilla or a real
monster.
3/16/2021 AI @ IT- by Ayana O. Kitil 133
6.5. Robotics
• Robots are physical agents that perform tasks by manipulating the physical world.
• To do so, they are equipped with effectors such as legs, wheels, joints, and grippers.
• Robots are also equipped with sensors, which allow them to perceive their environment.
• Present day robotics employs a diverse set of sensors, including cameras and lasers to
measure the environment, and gyroscopes and accelerometers to measure the robot’s own
motion.
o Example:
Unmanned Ground Vehicles (UGVs), drive autonomously on streets, highways, and off-
road.
Unmanned Air Vehicles (UAVs), commonly used for surveillance, crop-spraying, and
military operations.
Autonomous Underwater Vehicles (AUVs) are used in deep sea exploration.
o It delivers packages in the workplace and vacuum the floors at home.
3/16/2021 AI @ IT- by Ayana O. Kitil 137
6.5. Robotics, Cont. …(5)
b. Mobile Robots, …(2)
Fig. 6.2 (a) Predator, an unmanned aerial vehicle (UAV) used by the U.S. Military. Image courtesy of General Atomics
Aeronautical Systems. (b) NASA’s Sojourner, a mobile robot that explored the surface of Mars in July 1997.
3/16/2021 AI @ IT- by Ayana O. Kitil 138
6.5. Robotics, Cont. …(6)
c. Mobile Manipulators:
o It is a combination of mobile robots and manipulator.
o It can apply their effectors further a field than anchored manipulators can, but their task
is made harder because they don’t have the rigidity that the anchor provides.
• Real robots must cope with environments that are partially observable, stochastic,
dynamic, continuous, sequential and multi-agent.
• Partial observability and stochasticity are the result of dealing with a large,
complex world.
3/16/2021 AI @ IT- by Ayana O. Kitil 141
6.5. Robotics, Cont. …(9)
• Robot cameras cannot see around corners, and motion commands are subject to
uncertainty due to gears slipping, friction, etc.
• Practical robotic systems need to embody prior knowledge about the robot, its
physical environment, and the tasks that the robot will perform so that the robot
can learn quickly and perform safely.
3/16/2021 AI @ IT- by Ayana O. Kitil 142
6.5. Robotics, Cont. …(10)
Robot Hardware:
o The agent architecture - sensors, effectors, and processors.
a. Sensors – is the perceptual interface between robot and environment.
There types of sensors: Range Finder Sensors, Locations Sensors and Proprioceptive Sensors.
b. Effectors – the means by which robots move and change the shape of their bodies.
To understand the design of effectors, it will help to talk about motion and shape in the abstract, using
the concept of a degree of freedom (DOF).
o The success of real robots depends at least as much on the design of sensors and
effectors that are appropriate for the task.
3/16/2021 AI @ IT- by Ayana O. Kitil 143
Exercise:
1. Define communication, natural language and robotics with your own words!