Artificial Intelligence Lecture Note
Artificial Intelligence Lecture Note
Artificial Intelligence Lecture Note
FACULTY OF SCIENCE
400 LEVELS
LECTURE NOTE
ON
CPS 411
FOR
COMPUTER SCEINCE
COMPILED
BY
1
Artificial Intelligence
Definitions
Philosophy of AI
While exploiting the power of the computer systems, the curiosity of human,
lead him to wonder, “Can a machine think and behave like humans do?”
Goals of AI
To Create Expert Systems − The systems which exhibit intelligent
behavior, learn, demonstrate, explain, and advice its users.
Contributes to AI
2
Artificial intelligence is a science and technology based on disciplines such as
Computer Science, Biology, Psychology, Linguistics, Mathematics, and
Engineering. A major thrust of AI is in the development of computer functions
associated with human intelligence, such as reasoning, learning, and problem
solving.
Out of the following areas, one or multiple areas can contribute to build an
intelligent system.
AI Technique
In the real world, the knowledge has some unwelcomed properties −
Applications of AI
AI has been dominant in various fields such as −
4
Gaming − AI plays crucial role in strategic games such as chess, poker,
tic-tac-toe, etc., where machine can think of large number of possible
positions based on heuristic knowledge.
History of AI
5
Artificial intelligence (AI) is intelligence exhibited by machines. In computer
science, the field of AI research defines itself as the study of "intelligent
agents": any device that perceives its environment and takes actions that
maximize its chance of success at some goal. Colloquially, the term "artificial
intelligence" is applied when a machine mimics "cognitive" functions that
humans associate with other human minds, such as "learning" and "problem
solving".
1973 The Assembly Robotics group at Edinburgh University built Freddy, the
6
Famous Scottish Robot, capable of using vision to locate and assemble
models.
1985 Harold Cohen created and demonstrated the drawing program, Aaron.
INTELLIGENCE
While studying artificially intelligence, you need to know what intelligence is. This
chapter covers Idea of intelligence, types, and components of intelligence.
Intelligence
7
The ability of a system to calculate, reason, perceive relationships and analogies, learn
from experience, store and retrieve information from memory, solve problems,
comprehend complex ideas, use natural language fluently, classify, generalize, and
adapt new situations.
TYPES OF INTELLIGENCE
8
products, control over fine
and coarse motor skills, and
manipulate the objects.
Composed of Intelligence
The intelligence is intangible. It is composed of −
Reasoning
Learning
Problem Solving
Perception
Linguistic Intelligence
9
Deductive Reasoning
Inductive Reasoning
It starts with a general statement and
It conducts specific observations to
examines the possibilities to reach a
makes broad general statements.
specific, logical conclusion.
Even if all of the premises are true in a If something is true of a class of things
statement, inductive reasoning allows in general, it is also true for all
for the conclusion to be false. members of that class.
Example − "All women of age above 60
Example − "Nita is a teacher. All
years are grandmothers. Shalini is 65
teachers are studious. Therefore, Nita is
years. Therefore, Shalini is a
studious."
grandmother."
10
o Spatial Learning − It is learning through visual stimuli such as
images, colors, maps, etc. For Example, A person can create
roadmap in mind before actually following the road.
o Stimulus-Response Learning − It is learning to perform a
particular behavior when a certain stimulus is present. For
example, a dog raises its ear on hearing doorbell.
Problem Solving − It is the process in which one perceives and tries to
arrive at a desired solution from a present situation by taking some path,
which is blocked by known or unknown hurdles.
Humans can figure out the complete object even if some part of it is
missing or distorted; whereas the machines cannot do it correctly.
A robotic agent replaces cameras and infrared range finders for the sensors,
and various motors and actuators for effectors.
A software agent has encoded bit strings as its programs and actions.
Agent Terminology
Performance Measure of Agent − It is the criteria, which determines how
successful an agent is.
Behavior of Agent − It is the action that agent performs after any given
sequence of percepts.
Percept Sequence − It is the history of all that an agent has perceived till
date.
Agent
12
Agents are systems or software programs capable of autonomous, purposeful
and reasoning directed towards one or more goals. They are also called
assistants, brokers, bots, droids, intelligent agents, and software agents.
Autonomous Robot
Robot free from external control or influence and able to control itself
independently.
Backward Chaining
Blackboard
Environment
Forward Chaining
Heuristics
Knowledge Engineering
Percepts
It is the format in which the agent obtains information about the environment.
Pruning
13
Overriding unnecessary and irrelevant considerations in AI systems.
Rule
Shell
Task
Turing Test
14
Speech and Voice Recognition
These both terms are common in robotics, expert systems and natural language
processing. Though these terms are used interchangeably, their objectives are different.
15
accent, etc.
This source-language text becomes input to the Translation Engine, which converts it
to the target language text. They are supported with interactive GUI, large database of
vocabulary, etc.
S.No
Research Areas Example
.
Expert Systems
1
Examples − Flight-tracking systems, Clinical
systems.
16
Natural Language Processing
Neural Networks
Robotics
Task Classification of AI
The domain of AI is classified into Formal tasks, Mundane tasks, and Expert tasks.
17
EXPERT SYSTEM
Expert systems (ES) are one of the prominent research domains of AI. It is introduced
by the researchers at Stanford University, Computer Science Department.
18
High performance
Understandable
Reliable
Highly responsive
Capabilities of Expert Systems
The expert systems are capable of −
Advising
Instructing and assisting human in decision making
Demonstrating
Deriving a solution
Diagnosing
Explaining
Interpreting input
Predicting results
Justifying the conclusion
Suggesting alternative options to a problem
They are incapable of −
Knowledge Base
Inference Engine
User Interface
19
Knowledge Base
It contains domain-specific and high-quality knowledge. Knowledge is
required to exhibit intelligence. The success of any ES majorly depends upon
the collection of highly accurate and precise knowledge.
What is Knowledge?
The data is collection of facts. The information is organized as data and facts
about the task domain. Data, information, and past experience combined
together are termed as knowledge.
Knowledge representation
It is the method used to organize and formalize the knowledge in the
knowledge base. It is in the form of IF-THEN-ELSE rules.
Knowledge Acquisition
20
The success of any expert system majorly depends on the quality,
completeness, and accuracy of the information stored in the knowledge base.
The knowledge base is formed by readings from various experts, scholars, and
the Knowledge Engineers. The knowledge engineer is a person with the
qualities of empathy, quick learning, and case analyzing skills.
Inference Engine
Use of efficient procedures and rules by the Inference Engine is essential in
deducting a correct, flawless solution.
Applies rules repeatedly to the facts, which are obtained from earlier rule
application.
Forward Chaining
Backward Chaining
Forward Chaining
It is a strategy of an expert system to answer the question, “What can happen
next?”
Here, the Inference Engine follows the chain of conditions and derivations and
finally deduces the outcome. It considers all the facts and rules, and sorts them
before concluding to a solution.
21
This strategy is followed for working on conclusion, result, or effect. For
example, prediction of share market status as an effect of changes in interest
rates.
Backward Chaining
With this strategy, an expert system finds out the answer to the question, “Why
this happened?”
On the basis of what has already happened, the Inference Engine tries to find
out which conditions could have happened in the past for this result. This
strategy is followed for finding out cause or reason. For example, diagnosis of
blood cancer in humans.
User Interface
User interface provides interaction between user of the ES and the ES itself. It
is generally Natural Language Processing so as to be used by the user who is
well-versed in the task domain. The user of the ES need not be necessarily an
expert in Artificial Intelligence.
Application Description
23
with prescribed behavior such as leakage monitoring in
long petroleum pipeline.
Process Control
Controlling a physical process based on monitoring.
Systems
o Large databases.
Tools − They reduce the effort and cost involved in developing an expert
system to large extent.
24
o Java Expert System Shell (JESS) that provides fully developed
Java API for creating an expert system.
Know and establish the degree of integration with the other systems and
databases.
Realize how the concepts can represent the domain knowledge best.
25
Test and ensure the interaction of the ES with all elements of its
environment, including end users, databases, and other information
systems.
Cater for new interfaces with other information systems, as those systems
evolve.
Speed − They offer great speed. They reduce the amount of work an
individual puts in.
AI - Search Algorithms
Searching is the universal technique of problem solving in AI. There are some single-
player games such as tile games, Sudoku, crossword, etc. The search algorithms help
you to search for a particular position in such games.
26
The games such as 3X3 eight-tile, 4X4 fifteen-tile, and 5X5 twenty four tile puzzles are
single-agent-path-finding challenges. They consist of a matrix of tiles with a blank tile.
The player is required to arrange the tiles by sliding a tile either vertically or
horizontally into a blank space with the aim of accomplishing some objective.
The other examples of single agent pathfinding problems are Travelling Salesman
Problem, Rubik’s Cube, and Theorem Proving.
Search Terminology
Problem Space − It is the environment in which the search takes place.
(A set of states and set of operators to change those states)
Depth − Length of the shortest path from initial state to goal state.
Requirements −
State description
A set of valid operators
Initial state
27
Goal state description
Breadth-First Search
It starts from the root node, explores the neighboring nodes first and moves
towards the next level neighbors. It generates one tree at a time until the
solution is found. It can be implemented using FIFO queue data structure. This
method provides shortest path to the solution.
If branching factor (average number of child nodes for a given node) = b and
depth = d, then number of nodes at level d = bd.
Disadvantage − Since each level of nodes is saved for creating next one, it
consumes a lot of memory space. Space requirement to store nodes is
exponential.
Its complexity depends on the number of nodes. It can check duplicate nodes.
Depth-First Search
It is implemented in recursion with LIFO stack data structure. It creates the
same set of nodes as Breadth-First method, only in the different order.
As the nodes on the single path are stored in each iteration from root to leaf
node, the space requirement to store nodes is linear. With branching factor b
and depth as m, the storage space is bm.
28
Its complexity depends on the number of paths. It cannot check duplicate
nodes.
Bidirectional Search
It searches forward from initial state and backward from goal state till both
meet to identify a common state.
The path from initial state is concatenated with the inverse path from the goal
state. Each search is done only up to half of the total path.
Disadvantage − There can be multiple long paths with the cost ≤ C*. Uniform
Cost search must explore them all.
It never creates a node until all lower nodes are generated. It only saves a stack
of nodes. The algorithm ends when it finds a solution at depth d. The number
of nodes created at depth d is bd and at depth d-1 is bd-1.
29
Comparison of Various Algorithms Complexities
Let us see the performance of algorithms based on various criteria −
Interactiv
Breadth Bidirectiona Uniform
Criterion Depth First e
First l Cost
Deepening
Time bd bm bd/2 bd bd
Space bd bm bd/2 bd bd
Completenes
Yes No Yes Yes Yes
s
ROBOTICS
Objective
30
thereby freeing manpower from doing repetitive functions without getting
bored, distracted, or exhausted.
What is Robotics
Aspects of Robotics
AI Programs Robots
They usually operate in
They operate in real physical world
computer-stimulated worlds.
The input to an AI program is in Inputs to robots is analog signal in the form of
symbols and rules. speech waveform or images
They need general purpose They need special hardware with sensors and
computers to operate on. effectors.
Robot Locomotion
Legged
Wheeled
Combination of Legged and Wheeled Locomotion
31
Tracked slip/skid
Legged Locomotion
It comes with the variety of one, two, four, and six legs. If a robot has
multiple legs then leg coordination is necessary for locomotion.
Wheeled Locomotion
Standard wheel − Rotates around the wheel axle and around the contact
32
Castor wheel − Rotates around the wheel axle and the offset steering
joint.
Swedish 45o and Swedish 90o wheels − Omni-wheel, rotates around the
contact point, around the wheel axle, and around the rollers.
Slip/Skid Locomotion
In this type, the vehicles use tracks as in a tank. The robot is steered by moving
the tracks with different speeds in the same or opposite direction. It offers
stability because of large contact area of track and ground.
COMPONENTS OF A ROBOT
Robots are constructed with the following −
33
Actuators − They convert energy into movement.
Pneumatic Air Muscles − They contract almost 40% when air is sucked in
them.
COMPUTER VISION
This is a technology of AI with which the robots can see. The computer vision plays
vital role in the domains of safety, security, health, access, and entertainment.
Power supply
Image acquisition device such as camera
a processor
a software
A display device for monitoring the system
Accessories such as camera stands, cables, and connectors
34
OCR − In the domain of computers, Optical Character Reader, a software to
convert scanned documents into editable text, which accompanies a scanner.
Agriculture
Autonomous vehicles
Biometrics
Character recognition
Forensics, security, and surveillance
Industrial quality inspection
Face recognition
Gesture analysis
Geoscience
Medical imagery
Pollution monitoring
Process control
Remote sensing
Robotics
Transport
APPLICATIONS OF ROBOTICS
The robotics has been instrumental in the various domains such as −
Industries − Robots are used for handling material, cutting, welding, color
coating, drilling, polishing, etc.
35
Military − Autonomous robots can reach inaccessible and hazardous zones
during war. A robot named Daksh, developed by Defense Research and
Development Organization (DRDO), is in function to destroy life-threatening
objects safely.
Medicine − The robots are capable of carrying out hundreds of clinical tests
simultaneously, rehabilitating permanently disabled people, and performing
complex surgeries such as brain tumors.
Processing of Natural Language is required when you want an intelligent system like
robot to perform as per your instructions, when you want to hear decision from a
dialogue based clinical expert system, etc.
The field of NLP involves making computers to perform useful tasks with the natural
languages humans use. The input and output of an NLP system can be −
Speech
Written Text
COMPONENTS OF NLP
There are two components of NLP as given −
36
It involves −
DIFFICULTIES IN NLU
NL has an extremely rich form and structure.
For example, “He lifted the beetle with red cap.” − Did he use cap to lift the
beetle or he lifted a beetle that had red cap
NLP Terminology
Phonology − It is study of organizing sound systematically.
37
Semantics − It is concerned with the meaning of words and how to combine
words into meaningful phrases and sentences.
Discourse − It deals with how the immediately preceding sentence can affect
the interpretation of the next sentence.
Steps in NLP
There are general five steps −
38
Semantic Analysis − It draws the exact meaning or the dictionary
meaning from the text. The text is checked for meaningfulness. It is done
by mapping syntactic structures and objects in the task domain. The
semantic analyzer disregards sentence such as “hot ice-cream”.
39
Context-Free Grammar
Top-Down Parser
Let us see them in detail −
Context-Free Grammar
It is the grammar that consists rules with a single symbol on the left-hand side
of the rewrite rules. Let us create grammar to parse a sentence − “The bird
pecks the grains”
The parse tree breaks down the sentence into structured parts so that the
computer can easily understand and process it. In order for the parsing
algorithm to construct this parse tree, a set of rewrite rules, which describe
what tree structures are legal, need to be constructed.
These rules say that a certain symbol may be expanded in the tree by a
sequence of other symbols. According to first order logic rule, if there are two
strings Noun Phrase (NP) and Verb Phrase (VP), then the string combined by
NP followed by VP is a sentence. The rewrite rules for the sentence are as
follows −
S → NP VP
VP → V NP
Lexocon −
DET → a | the
40
ADJ → beautiful | perching
Now consider the above rewrite rules. Since V can be replaced by both, "peck"
or "pecks", sentences such as "The bird peck the grains" with wrong subject-
verb agreement are also permitted.
Demerits
They are not highly precise. For example, “The grains peck the bird”, is a
syntactically correct according to parser, but even if it makes no sense,
parser takes it as a correct sentence.
41
To bring out high precision, multiple sets of grammar need to be
prepared. It may require a completely different sets of rules for parsing
singular and plural variations, passive sentences, etc., which can lead to
creation of huge set of rules that are unmanageable.
Top-Down Parser
Here, the parser starts with the S symbol and attempts to rewrite it into a
sequence of terminal symbols that matches the classes of the words in the input
sentence until it consists entirely of terminal symbols.
These are then checked with the input sentence to see if it matched. If not, the
process is started over again with a different set of rules. This is repeated until
a specific rule is found which describes the structure of the sentence.
Merit
It is simple to implement.
Demerits
Fuzzy Logic Systems (FLS) produce acceptable but definite output in response to
incomplete, ambiguous, distorted, or inaccurate (fuzzy) input.
The conventional logic block that a computer can understand takes precise input and
produces a definite output as TRUE or FALSE, which is equivalent to human’s YES or
NO.
The inventor of fuzzy logic, Lotfi Zadeh, observed that unlike computers, the human
decision making includes a range of possibilities between YES and NO, such as −
42
CERTAINLY
YES
POSSIBLY YES
CANNOT SAY
POSSIBLY NO
CERTAINLY NO
The fuzzy logic works on the levels of possibilities of input to achieve the definite
output.
Implementation
It can be implemented in systems with various sizes and capabilities ranging
from small micro-controllers to large, networked, workstation-based control
systems.
LP x is Large Positive
MP x is Medium Positive
S x is Small
MN x is Medium Negative
LN x is Large Negative
Knowledge Base − It stores IF-THEN rules provided by experts.
43
Inference Engine − It simulates the human reasoning process by making
fuzzy inference on the inputs and IF-THEN rules.
Automotive Systems
Automatic Gearboxes
Four-Wheel Steering
Vehicle environment control
Consumer Electronic Goods
Hi-Fi Systems
Photocopiers
Still and Video Cameras
Television
Domestic Goods
Microwave Ovens
Refrigerators
Toasters
Vacuum Cleaners
Washing Machines
Environment Control
Air Conditioners/Dryers/Heaters
Humidifiers
Advantages of FLSs
Mathematical concepts within fuzzy reasoning are very simple.
You can modify a FLS by just adding or deleting rules due to flexibility of
fuzzy logic.
Fuzzy logic Systems can take imprecise, distorted, noisy input information.
44
FLSs are easy to construct and understand.
Disadvantages of FLSs
The human brain is composed of 100 billion nerve cells called neurons. They are
connected to other thousand cells by Axons. Stimuli from external environment or
inputs from sensory organs are accepted by dendrites. These inputs create electric
impulses, which quickly travel through the neural network. A neuron can then send the
message to other neuron to handle the issue or does not send it forward.
45
ANNs are composed of multiple nodes, which imitate biological neurons of human
brain. The neurons are connected by links and they interact with each other. The nodes
can take input data and perform simple operations on the data. The result of these
operations is passed to other neurons. The output at each node is called its activation
or node value.
46
ANNs are capable of learning and they need to be trained. There are several learning
strategies −
For example, pattern recognizing. The ANN comes up with guesses while
recognizing. Then the teacher provides the ANN with the answers. The network
then compares it guesses with the teacher’s “correct” answers and makes
adjustments according to errors.
Medical − Cancer cell analysis, EEG and ECG analysis, prosthetic design,
transplant time optimizer.
Time Series Prediction − ANNs are used to make predictions on stocks and
natural calamities.
Threat to Privacy
48
An AI program that recognizes speech and understands natural language is
theoretically capable of understanding each conversation on e-mails and
telephones.
Threat to Safety
The self-improving AI systems can become so mighty than humans that could
be very difficult to stop from achieving their goals, which may lead to
unintended consequences.
49
Pattern Recognition & Biometrics
Pattern recognition deals with identifying a pattern and confirming it again. In
general, a pattern can be a fingerprint image, a handwritten cursive word, a
human face, a speech signal, a bar code, or a web page on the Internet.
The individual patterns are often grouped into various categories based on their
properties. When the patterns of same properties are grouped together, the
resultant group is also a pattern, which is often called a pattern class.
Character Recognition
Optical signals or Strokes Name of the character
(Signature Recognition)
50
Pattern recognition technique extracts a random pattern of human trait into a
compact digital signature, which can serve as a biological identifier. The
biometric systems use pattern recognition techniques to classify the users and
identify them separately.
The operations of a biometric system depend heavily on the input devices that
are subjected to operational limitations. At times, the devices themselves may
51
fail to capture the necessary input samples. They may not capture the sample
sufficiently. This makes the system unreliable and vulnerable.
The more vulnerable a biometric system is, the more insecure it is.
System Failures
There are two ways in which a biometric system can fail to work −
Non-secure Infrastructure
The biometric system can be accessible to malicious users if its hardware,
software, and user data are not safeguarded.
52
Biometric System Security
A number of solutions are proposed to address the biometric system security
issue. Biometric templates are never stored in the raw form. They are
encrypted; sometimes even twice.
In the case of biometrics, there are various resources involved such as humans
(subjects or candidates), entities (system components or processes), and
biometric data (information). The security requirements of confidentiality,
integrity, authenticity, non-repudiation, and availability are essential in
biometrics. Let us go through them briefly −
Authenticity
It is the quality or the state of being pure, genuine, or original, rather than being
reproduced. Information is authentic when it is in the same state and quality
when it was created, stored, or transferred.
Confidentiality
It is limiting information access and disclosure to authorized users and
preventing access by or disclosure to unauthorized people. In cases of a
biometric system, it mainly refers to biometric and related authentication
information when it is captured and stored, which needs to be kept secret from
unauthorized entities.
Integrity
It is the condition of being complete and unaltered that refers to its consistency,
accuracy, and correctness. For a biometric system, the integrity should be high.
Any malicious manipulations during operation and storage should be kept
away or detected earliest by including its notification and correction.
53
Non-repudiation
It is identification of involved resources such as entities and components. It is
also seen as accountability. For example, it prohibits a sender or a recipient of
biometric information from denying having sent or received biometric
information.
Availability
A resource has the property of availability with respect to a set of entities if all
members of the set can access the resource. An aspect called reachability
ensures that the humans or system processes either can or cannot be contacted,
depending on user interests.
Attackers can make the system unusable for genuine users, thus preventing
them from using authenticated applications. These attackers target the
availability of the information.
54
The ‘renewable’ and ‘unlinkable’ characteristics are achieved through
salting techniques. Salting adds randomly generated unique data known
as ‘salt’ to the original information to make it distinct from the others.
55