AI Notes PDF

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 82

Artificial Intelligence (6th sem) BCA

Chapter 1:

Introduction to Artificial

Definition: Intelligence

"It is a branch of computer science by which intelligent machines is created which can behave
like a human, think like humans, and able to make decisions."

Or

According to the father of Artificial Intelligence, John McCarthy, it is “The science and
engineering of making intelligent machines, especially intelligent computer programs”.

Artificial Intelligence is composed of two words Artificial and Intelligence, where Artificial
defines "man-made," and intelligence defines "thinking power", hence AI means "a man-made
thinking power."

Components of Intelligence:
1) Learning

2)Reasoning

3)Linguistic Intelligence

4)Perception

5) Problem solving

1) Learning:

 It is the activity of gaining knowledge or skill by studying, practicing, being taught, or


experiencing something. Learning enhances the awareness of the subjects of the study.
 The ability of learning is possessed by humans, some animals, and AI-enabled systems.

2) Reasoning − It is the set of processes that enables us to provide basis for judgement,
making decisions, and prediction.

3)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.

Page 1
Artificial Intelligence (6th sem) BCA

Problem solving also includes decision making, which is the process of selecting the best
suitable alternative out of multiple alternatives to reach the desired goal are available.

4)Perception − It is the process of acquiring, interpreting, selecting, and organizing sensory


information. Perception presumes sensing. In humans, perception is aided by sensory organs. In
the domain of AI, perception mechanism puts the data acquired by the sensors together in a
meaningful manner.

5)Linguistic Intelligence − It is one’s ability to use, comprehend, speak, and write the verbal
and written language. It is important in interpersonal communication.

7) 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.

8)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 do

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?”
Thus, the development of AI started with the intention of creating similar intelligence in
machines that we find and regard high in humans.

Types of AI

Weak AI or Narrow AI:

o Narrow AI is a type of AI which is able to perform a dedicated task with intelligence. The
most common and currently available AI is Narrow AI in the world of Artificial
Intelligence.
o Narrow AI cannot perform beyond its field or limitations, as it is only trained for one
specific task. Hence it is also termed as weak AI. Narrow AI can fail in unpredictable ways
if it goes beyond its limits.

Page 2
Artificial Intelligence (6th sem) BCA

o Apple Siri is a good example of Narrow AI, but it operates with a limited pre-defined range
of functions.
o IBM's Watson supercomputer also comes under Narrow AI, as it uses an Expert system
approach combined with Machine learning and natural language processing.
o Some Examples of Narrow AI are playing chess, purchasing suggestions on e-commerce
site, self-driving cars, speech recognition, and image recognition.

2. General AI:

o General AI is a type of intelligence which could perform any intellectual task with
efficiency like a human.
o The idea behind the general AI to make such a system which could be smarter and think
like a human by its own.
o Currently, there is no such system exist which could come under general AI and can
perform any task as perfect as a human.
o The worldwide researchers are now focused on developing machines with General AI.
o As systems with general AI are still under research and it will take lots of efforts and time
to develop such systems.

3. Super AI:

o Super AI is a level of Intelligence of Systems at which machines could surpass human


intelligence, and can perform any task better than human with cognitive properties. It is
an outcome of general AI.
o Some key characteristics of strong AI include capability include the ability to think, to
reason, solve the puzzle, make judgments, plan, learn, and communicate by its own.
o Super AI is still a hypothetical concept of Artificial Intelligence. Development of such
systems in real is still world changing task.

Goals of AI
 To Create Expert Systems − The systems which exhibit intelligent behavior, learn,
demonstrate, explain, and advice its users.

Page 3
Artificial Intelligence (6th sem) BCA

 To Implement Human Intelligence in Machines − Creating systems that understand,


think, learn, and behave like humans.
Types of Intelligence
1) Linguistic Intelligence

 It is the ability to speak, recognize and use the mechanism of grammar, semantic and
phonology, It is an ability to think and express the scenario easily as user understands

Ex: Novelist, Journalist.

2) Musical Intelligence

 It is an ability to analyses pitch, rhythm and tone.


 This enables us to recognize, create, reproduce and reflect it on the
music. Ex: Musician, singers.

3) Spatial Intelligence

 It is an ability to think in virtualization this builds the capacity to visualize the things
manipulate the images, construct 3D images etc.

Ex: Graphics, game developer, architect.

4) Interpersonal Intelligence

 It is an ability to interact, understand other efficiency.


 The person must have an ability to note and react sensitivity with others depending on
mood of another person. The person with this type of intelligence will have multiple
perspectives on one situation

Ex: politicians, leader, social worker.

5) Intrapersonal Intelligence

 It is the capacity to understand oneself and once thoughts and feelings


 They are self-motivated and they are very much aware of their own feelings

Page 4
Artificial Intelligence (6th sem) BCA

Ex: Spiritual Leader, philosopher.

6) Kinetic Intelligence/bodily intelligence

 It is the capacity to manipulate the object by using physical skills this involves timings,
perfection

Ex: Surgeons or athletes

7) Logical-mathematical Intelligence

 It is an ability to calculate quantify and carry out mathematical operations.


 It helps in solving complex problems by a simple technique
 It is an ability to understand the relationship in the absence of an

object Ex: Scientist, mathematician etc.

Knowledge

Humans are best at understanding, reasoning, and interpreting knowledge. Human knows things,
which is knowledge and as per their knowledge they perform various actions in the real
world. But how machines do all these things comes under knowledge representation and
reasoning. Hence we can describe Knowledge representation as following:

o Knowledge representation and reasoning (KR, KRR) is the part of Artificial intelligence
which concerned with AI agents thinking and how thinking contributes to intelligent
behavior of agents.
o It is responsible for representing information about the real world so that a computer can
understand and can utilize this knowledge to solve the complex real world problems such
as diagnosis a medical condition or communicating with humans in natural language.
o It a way which describes to represent knowledge in artificial intelligence. Knowledge
representation is not just storing data into some database, but it also enables an intelligent
machine to learn from that knowledge and experiences so that it can behave intelligently
like a human.

Page 5
Artificial Intelligence (6th sem) BCA

Thinks need to be represented which is in the form of knowledge

 Object: All the facts about objects in our world domain. E.g., Guitars contains strings,
trumpets are brass instruments.
 Events: Events are the actions which occur in our world.
 Performance: It describe behavior which involves knowledge about how to do things.
 Meta-knowledge: It is knowledge about what we know.
 Facts: Facts are the truths about the real world and what we represent.
 Knowledge-Base: The central component of the knowledge-based agents is the knowledge
base. It is represented as KB. The Knowledgebase is a group of the Sentences (Here,
sentences are used as a technical term and not identical with the English language).

Types of knowledge
1. Declarative Knowledge:

 Declarative knowledge is to know about something.


 It includes concepts, facts, and objects.
 It is also called descriptive knowledge and expressed in declarative sentences.
 It is simpler than procedural language.

2. Procedural Knowledge

 It is also known as imperative knowledge.


 Procedural knowledge is a type of knowledge which is responsible for knowing how
to do something.
 It can be directly applied to any task.
 It includes rules, strategies, procedures, agendas, etc.
 Procedural knowledge depends on the task on which it can be applied.

3. Meta-knowledge:

Knowledge about the other types of knowledge is called Meta-knowledge.

4. Heuristic knowledge:

 Heuristic knowledge is representing knowledge of some experts in a filed or subject.


 Heuristic knowledge is rules of thumb based on previous experiences, awareness
of approaches, and which are good to work but not guaranteed.

5. Structural knowledge:

Page 6
Artificial Intelligence (6th sem) BCA

 Structural knowledge is basic knowledge to problem-solving.


 It describes relationships between various concepts such as kind of, part of, and
grouping of something.
 It describes the relationship that exists between concepts or objects.

Techniques for knowledge representation


There are several techniques of knowledge representation and they are

1) Semantic network representation

2) Frame Representation

3) Production rules

4) Logical representation

1) Semantic network representation

In this approach knowledge is represented in the form of graphical network here the nodes
are represents objects and they describes their relationship between the object.

 It is easy to understand
 It is easy to extend the

knowledge Example

 Jerry is a cat
 Jerry is a mammal
 Jerry is owned by priya
 Jerry is brown in color
 All mammals are animals

In the above example Jerry, cat, priya, brown, animals, mammals are the objects and the
relationship between the objects are represented by using IS-A,IN-COLOR,IS-OWNED_BY,etc
relationships as shown below .

Page 7
Artificial Intelligence (6th sem) BCA

2) Frame representation

 The frame is record like a structure which contains collection of attribute and its
value to describe real world entity.
 The frame is a data structure in AI which is a collection of values for single slot.
 This is also called as slot filter knowledge representation

Ex: priya is a doctor and her age is 30 she lives in delhi and she is married.

Name Priya
Profession Doctor
Age 30
Place Delhi
Marital status Married
3) Production rules:

 It consists of condition, action pair i.e If condition then action

Page 8
Artificial Intelligence (6th sem) BCA

 The condition contains the production rules if it matches the condition then it
performs corresponding action.
 This is also called as recognize act cycle

Ex: if( In bus stand && you have Bus )


then
action(get inside the bus)
if(in BUS && not paid )
then
action (pay the amount)

4) Logical representation:

The logical representation means drawing the conclusion based on various condition.

This representation provide the predefined syntax and semantic rules

Each sentence can be translated into the logic using syntax and semantics and it is categorized
into 2 types

1) Propositional logic

2) Predicate logic

1) Propositional logic

 The declarative statements which are either true or false


 These statements are joined by the connectors like
AND(&&),OR(||),Negation(~), Implication (->),Bi conditional ()
Ex: P: Jerry is a cat
Q: Jerry is a mammal
pQ:if jerry is a cat then jerry is a mammal.

2) Predicate logic

 It is extended form of a propositional logic it is also called as first order predicate logic .
 It contains objects, relations and function.
 It has connectors like for all and there exit’s.

Page 9
Artificial Intelligence (6th sem) BCA

Difference between programming with AI and programming without AI

Programming Without AI Programming With AI

A computer program without AI can A computer program with AI can answer


answer the specific questions it is the generic questions it is meant to solve.
meant to solve.

Modification in the program leads to Can modify even a minute piece of information
change in its structure. of program without affecting its structure.

Modification is not quick and easy.


It may lead to affecting the program Quick and Easy program modification.
adversely.

History of AI

 In 1950, Alan Turing devised the Turing test. If a machine could carry on a conversation
that was indistinguishable from a conversation with a human being, then it was
reasonable to say that the machine was thinking.
 1956 to 74 is called as the golden era for AI. The Wabot project in 1967 built a robot that
could measure distances and directions to objects using external receptors, artificial eyes,
and ears. And its conversation system allowed it to communicate with a person in
Japanese, with an artificial mouth.
 In the 1980s a form of AI program called Expert Systems was adopted by corporations
around the world and knowledge became the focus of mainstream AI research.
 A new paradigm called Intelligent Agents became widely accepted during the 1990s. It is
a system that perceives its environment and takes actions that maximize its chances of
success.
 In the first decades of the 21st century, access to large amounts of data, faster computers,
and advanced machine learning techniques was successfully applied to many problems
throughout the economy.

Page 10
Artificial Intelligence (6th sem) BCA

 In 2000, Professor Cynthia Breazeal developed Kismet, a robot that could recognize and
simulate emotions with its face. It was structured like a human face with eyes, lips,
eyelids, and eyebrows.
 In 2009, Google secretly developed a driverless car. By 2014, it passed Nevada’s
self- driving test.

Research areas of AI
1. Expert System

 It is a computer system that simulates the decision-making ability of a human expert.


 it is used to solve the complex problem by using a previous knowledge.
 It is used the knowledge stored in the knowledge bas to solve the problem
 It can advice the user and provides explanation to the user about how to solve
the problem.
 It is mainly used in a medical field.

Ex : procto, mycin

2) Natural Language Processing

 It is the branch of AI that deals with interaction between the computer and the
humans using natural language.
 The objective of NLP is to read, understand and make a sense of human

language Ex: it is used in language translation application -Google translator

3) Fuzzy logic

 It is the method of reasoning that resembles the human reasoning capacity.


 The approach of fuzzy logic imitates the way of decision making in humans that
involves all intermediate possible values between yes and no.
 It provides flexibility for reasoning.
 It is used in aerospace field for altitude control.

4) Neural network

Page 11
Artificial Intelligence (6th sem) BCA

 A computing system made up of simple and highly inner connected processing


elements which process the information by external input.
 It is inspired by biological neural network which resembles animal brain.
 It is used in prediction or fore casting
 It is used in business analysis

5) Robotics

 It is the branch of AI and engineering that involves conception, design, manufacture and
operation of robots
 It deals with study of creating intelligent and efficient machines.
 Its is used in industries for cutting, welding, drilling etc.
 It is used in military, medical field, entertainment.

Applications of AI
 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.
 Natural Language Processing − It is possible to interact with the computer that
understands natural language spoken by humans.
 Expert Systems − There are some applications which integrate machine, software, and
special information to impart reasoning and advising. They provide explanation and
advice to the users.
 Vision Systems − These systems understand, interpret, and comprehend visual input on
the computer.
For example,
 A spying aero plane takes photographs, which are used to figure out spatial
information or map of the areas.
 Doctors use clinical expert system to diagnose the patient.
 Police use computer software that can recognize the face of criminal with the
stored portrait made by forensic artist.

Page 12
Artificial Intelligence (6th sem) BCA

 Speech Recognition − Some intelligent systems are capable of hearing and


comprehending the language in terms of sentences and their meanings while a human talk
to it. It can handle different accents, slang words, noise in the background, change in
human’s noise due to cold, etc.
 Handwriting Recognition − The handwriting recognition software reads the text written
on paper by a pen or on screen by a stylus. It can recognize the shapes of the letters and
convert it into editable text.
 Intelligent Robots − Robots are able to perform the tasks given by a human. They have
sensors to detect physical data from the real world such as light, heat, temperature,
movement, sound, bump, and pressure. They have efficient processors, multiple sensors
and huge memory, to exhibit intelligence. In addition, they are capable of learning from
their mistakes and they can adapt to the new environment.

Task domains of AI
1) Formal Task (rules and regulations)
 This task having fixed rules and logics to be applied.
 It includes developing Games
 It includes developing mathematical applications, theorem -proving, mathematical
calculations.

2) Mundane task or Ordinary task


 These are the common things that humans do every day.
 It includes perception, vision, and speech recognization.
 It includes language processing like understanding the language,
language translation.
 It includes common sense, reasoning and planning.

3) Expert Task
 These are the task that are done by same domain experts
 It contains the task like fault finding, manufacturing, monitoring etc.
 It is used in mission planning for under water vehicles, matlabs etc.
 It contains task in the field of scientific analysis, financial analysis, medical
diagnosis.

Page 13
Chapter 2: Agent and Environment

Chapter 2- Agent and Environment


The AI system consists of the agent and environment; the agents will acts up on the
environment.

Agent:

 An agent is anything that can be viewed as perceiving its environment through sensors
and acting upon that environment through actuators.
 An Agent runs in the cycle of perceiving, thinking, and acting.
 The agent receives the information from the environment from sensors and store and
process the information in the agent program do the actions by using the effectors.

The agent consists of the following terms

Sensors:

 Sensor is a device which detects the change in the environment and sends the information
to other electronic devices.
 Sensors can be camera, infrared ray’s devices, keyboard, eye, ear
etc. Effectors:
 Effectors are the devices which affect the environment.
 Effectors can be legs, wheels, arms, fingers, wings, fins, and display
screen. Actuators:
 Actuators are the component of machines that converts energy into motion.
 The actuators are only responsible for moving and controlling a system.
 An actuator can be an electric motor, gears, rails,
etc The agent can be
1) Software as agent Software agent can have keystrokes, file contents as sensory input and act
on those inputs and display output on the screen.
2) Robot as an agent A robotic agent can have cameras, infrared range finder, NLP for sensors
and various motors for actuators.
Chapter 2: Agent and Environment

3) Human as an agent A human agent has eyes, ears, and other organs which work for sensors
and hand, legs, vocal tract work for actuators.
Terminologies related to Agent:
 Percept (Sense): It is the agent’s perceptual data at the present
instance. Example: The automated AC detects the temperature at 10 o
clock.
 Percept Sequence: It is the history of all the percept the agent receives till
now. Example: The automated AC can store the temperature it sensed till now.
 Agent Function: An agent function is a map from the percept sequence (history of all
that an agent has perceived till date) to an action.
 Agent program: It is an implementation of agent function.
 Performance of the agent: It is the criteria used to determine how the agent is successful
in its action.
Example: if it is a self driving car performance is analyzed by the time it takes to reach
the destination .if it reaches the destination at the given time then that agent is successful
in its task and user says that it is performing well.
 Behavior of the agent: It is the action that agent performs after any given sequence of
percepts.
Example: For the self driving if the car applies break properly if any vehicle comes in
front of it suddenly then we will say it is acting correctly to the received actions.
Structure of the Agent
 An intelligent agent is a combination of Agent Program and Architecture.
 Intelligent Agent = Agent Program + Architecture
 Architecture is a machine in which the agent runs.
 The agent program is an implementation of an agent function.
Example:
Washing Machine is an AI agent so it consists of two things
 The agent program is programming chip the machine contains.
 The architecture is the washing machine’s hardware parts or washing machine
itself. Example of an agent, environment and its structure
Chapter 2: Agent and Environment

Consider the above vacuum cleaner and list the following properties for it.
Environment: Room A and Room B.
Status of environment: Dirty, Clean
Percept: [location and status] i.e. [A,
dirty] Action: left, right, suck no
operation.
Agent function: it is mapping between the percept sequence and the action
 In the above example the vacuum cleaner will works in two room A and B,it will
move from A and B automatically if current room it clean
 Its moving actions are left and right and it will perform suck operation if it detects
the dirt.
 Observe the following list of percept and actions
Percept Actions
[A, dirty] Suck
[A, clean] Right
[B. dirty] suck
[B, clean] Left
[A, clean][A, dirty] suck

Intelligent Agent :
An agent which acts in a way that is expected to maximize to its performance measure,
given the evidence provided by what it perceived and whatever built-in knowledge it has.
Rationality is nothing but status of being reasonable, sensible, and having good sense of
judgment.
Rationality of Agent:
It is the performance measure of the agent which would defines the criteria of success.
Example:
Chapter 2: Agent and Environment

 Consider the vacuum cleaner which cleanse two rooms A and B, it can take rest for some
time by going to sleep mode. It may make the noise while sucking.
 So to measure the performance its cleanliness is not only the criteria but we must
consider its noise, it’s time to travel between two rooms, its sleeping time etc will come
into picture while deciding its performance.
Rationality of the agent is measured by following criteria:
The performance measure that defines the criterion of success.
The agent prior knowledge of the environment.
The possible actions that the agent can
perform. The agent’s percept sequence to date.
PEAS
 Task environment of any agent is decided by PEAS.
 Following are the Properties of the agent to be listed while designing the rational agent.
P: Performance of the AI system.
E: Environment in which it acts.
A: Actuators
S: Sensors
PEAS for Self driving car
 Performance: Safety, time, legal drive, comfort.
 Environment: Roads, other cars, pedestrians, road signs.
 Actuators: Steering, accelerator, brake, signal, horn.
 Sensors: Camera, sonar, GPS, Speedometer, odometer, accelerometer, engine sensors,
keyboard.
PEAS for Vacuum cleaner
 Performance: cleanness, efficiency: distance traveled to clean,battery life, security.
 Environment: room, table, wood floor, carpet, different obstacles.
 Actuators: wheels, different brushes, vacuum extractor.
 Sensors: camera, dirt detection sensor, cliff sensor, bump sensors, infrared wall sensors.
Chapter 2: Agent and Environment

Types of the agents


1) Simple reflex agent
2) Model reflex agent
3) Goal based agent
4) Utility based agent
5) Learning agent
1) Simple reflex agent:

 Simple reflex agents act only on the basis of the current percept.
 The agent function is based on the condition-action rule i.e If (condition) then else
 A condition-action rule is a rule that maps a state i.e, condition to an action.
 If the condition is true, then the action is taken, else not.
 Example: if( temp>40 )
Then
Turn on the AC.
 This agent function only succeeds when the environment is fully observable
environment. Limitations:
Very limited intelligence.
No knowledge of non-perceptual parts of state.
Usually too big to generate and store.
Chapter 2: Agent and Environment

If there occurs any change in the environment, then the collection of rules need to be
updated.
2) Model Reflex agent

These are the agents with memory. It stores the information about the previous state, the
current state and performs the action accordingly.
It mainly has two parts
1) Model: It represents the knowledge about the world.it stores the complete aspects of the task
that agent is performing.
Example: If it is a self driving car then Model contains complete knowledge about driving car .
2) Internal representation: It represents the mapping between the current percept and the
previous history of the agent.
Example: while driving, if the driver wants to change the lane, he looks into the mirror to
know the present position of vehicles behind him. While looking in front, he can only see
the vehicles in front, and as he already has the information on the position of vehicles
behind him (from the mirror a moment ago), he can safely change the lane.
The previous and the current state get updated quickly for deciding the
action. It works well in partially observable environment
3) Goal Based Agent:
Chapter 2: Agent and Environment

 These are the agents whose aim is to reach the Goal


 These agents will take the decisions not only based on the current percept but also using
the knowledge of the GOAL .i.e. The agent will think whether the present action will
helps to reach the destination.
 This involves the searching and planning concepts to take the actions and to reach the
GOAL.
Example:
If the agent is a self-driving car and the goal is the destination, then the
information of the route to the destination helps the car in deciding when to turn
left or right.
So in the above example the agent takes the actions according to current percept
and the GOAL.
Chapter 2: Agent and Environment

4) Utility based agents

 These agents are used when there is multiple options to achieve the goal and to determine
which option is best.
 The utility based agent chooses the best option based on the users preferences, utility
describes the happiness of the agent along with reaching the goal.
i.e. Sometimes achieving the desired goal is not enough. We may look for a quicker,
safer, cheaper trip to reach a destination.
 The utility based agent chooses the action which gives maximum degree of happiness or
satisfaction.
Example: for a self driving car the destination is known, but there are multiple
routes. Choosing an appropriate route also matters to the overall success of the agent.
There are many factors in deciding the route like the shortest one, the comfortable
one, etc.
Chapter 2: Agent and Environment

5) Learning Agent:

 A learning agent in AI is the type of agent which can learn from its past experiences or it
has learning capabilities.
 It starts to act with basic knowledge and then able to act and adapt automatically through
learning.
A learning agent has mainly four conceptual components, which are:
Learning element: It is responsible for making improvements by learning from the environment
Critic: Learning element takes feedback from critic (Analysis )which describes how well the
agent is doing with respect to a fixed performance standard.
Performance element: It is responsible for selecting external action
Problem Generator: This component is responsible for suggesting actions that will lead to new
and informative experiences.
Example: Human is the best example for learning agent who can learn the things from
environment and can analyze whether it is right or wrong and act on the environment
when it is required.
Types of environment
1. Fully Observable vs. Partially Observable
 When an agent sensor is capable to sense or access the complete state of an agent at each
point in time, it is said to be a fully observable environment.
 If an agent is not capable to sense the complete state of the agent at each point of time is
called as it is partially observable.
Chapter 2: Agent and Environment

 Maintaining a fully observable environment is easy as there is no need to keep track of


the history of the surrounding.
Example:
Chess – the board is fully observable, a player can see his part of moves and the opponent
part of moves as well.
Poker (cards) – the environment is partially observable because the player can see the
moves in his hand but cannot able to see the cards in the other player’s hands.
2. Deterministic vs. Stochastic
 The agent’s current state completely determines the next state of the agent, then the
environment is said to be deterministic environment. It has uniqueness in the agent
 The agent’s current state cannot completely determine next state of the agent, and then it
is called as stochastic environment. It has randomness in its moves.
Example:
Traffic signal: If the person in the traffic signal is the agent then base on his present color
of signal he can determines next state of the signal so it is deterministic environment.
Self driving car: For self driving car it cannot determines its next action based on present
action it may varies frequently so it is stochastic environment
3. Single-agent vs. Multi-agent
 An environment consisting of only one agent is said to be a single-agent environment.
 An environment involving more than one agent is a multi-agent environment.
Example:
The game of football is multi-agent as it involves 11 players in each team.
A person left alone in a maze is an example of the single-agent system.
4. Dynamic vs. Static
 An environment that keeps constantly changing itself when the agent is up with some
action is said to be dynamic.
 An environment with no change in it as the agent is acting is called a static environment.
Chapter 2: Agent and Environment

Example:
Vacuum cleaner in the room whose environment will not change as the it cleans the room
every time so it is static environment
Chess game the coins will move each and every minutes so it is dynamic environment
5. Discrete vs. Continuous
 If an environment consists of a finite number of actions that can be deliberated in the
environment to obtain the output, it is said to be a discrete environment.
 The environment in which the actions performed cannot be numbered ie. is not discrete,
is said to be continuous.
Example:
Self-driving cars are an example of continuous environments as their actions is driving,
parking, etc. which cannot be numbered.
The game of chess is discrete environment as it has only a finite number of moves. The
number of moves might vary with every game, but still, it’s finite.

6. Episodic vs. sequential:

 If in an environment an action on current situation will not affects the actions on present
and previous sates then it is called as episodic environment.
 Here set of actions will perform based on current percept and it will not affect the next
actions.

Example:-

Chat bot: It is the best example of episodic environment because it will answers the
particular question we asked and the next answer will not be linked to the previous
questions.
Chess: This is an example of sequential because every move in chess will depends on its
previous moves and the every current move will affect next move.

7. Known vs Unknown
Chapter 2: Agent and Environment

o Known and unknown are not actually a feature of an environment, but it is an agent's
state of knowledge to perform an action.
o In a known environment, the results for all actions are known to the agent. While in
unknown environment, agent needs to learn how it works in order to perform an action.

o It is quite possible that a known environment to be partially observable and an Unknown


environment to be fully observable.

8. Accessible vs Inaccessible

o If an agent can obtain complete and accurate information about the state's environment,
then such an environment is called an Accessible environment else it is called
inaccessible.
o An empty room whose state can be defined by its temperature is an example of an
accessible environment.
o Information about an event on earth is an example of Inaccessible environment.
S
Chapter 3: Popular Search Algorithms

Unit 3 Popular Search Algorithms


Problem-solving agents:

In Artificial Intelligence, Search techniques are universal problem-solving methods. Rational


agents or Problem-solving agents in AI mostly used these search strategies or algorithms to solve
a specific problem and provide the best result. Problem-solving agents are the goal-based agents
and use atomic representation.

Search Algorithm Terminologies:

1. Search: Searching is a step-by-step procedure to solve a search-problem in a given search space.


A search problem can have three main factors:
a. Search Space: Search space represents a set of possible solutions, which a system
is having.
b. Start State: It is a state from where agent begins the search.
c. Goal test: It is a function which observe the current state and returns whether the
goal state is achieved or not.
2. Search tree: A tree representation of search problem is called Search tree. The root of the search
tree is the root node, which is corresponding to the initial state.
3. Actions: It gives the description of all the available actions to the agent.
4. Transition model: A description of what each action do, is represented as a transition model.
5. Path Cost: It is a function, which assigns a numeric cost to each path.
6. Solution: It is an action sequence, which leads from the start node to the goal node.
7. Optimal Solution: If a solution has the lowest cost among all solutions.

Properties of Search Algorithms:

The essential properties of search algorithms to compare the efficiency of the algorithms are as
follows:

Completeness: A search algorithm is said to be complete if it guarantees to return a solution if at


least any solution exists for any random input.
Optimality: If a solution found for an algorithm is guaranteed to be the best solution (lowest
path cost) among all other solutions, then such a solution for is said to be an optimal solution.
Time Complexity: Time complexity is a measure of time for an algorithm to complete its task.
S
Chapter 3: Popular Search Algorithms

Space Complexity: It is the maximum storage space required at any point during the search, as
the complexity of the problem.

Types of search algorithms

Based on the search problems the search algorithms are classified into uninformed (Blind
search) search and informed search (Heuristic search) algorithms.

Uninformed/Blind Search:
 The uninformed search does not contain any domain knowledge such as closeness, the
location of the goal.
 It operates in a brute-force way as it only includes information to traverse the tree and to
identify leaf and goal nodes.
S
Chapter 3: Popular Search Algorithms

 Uninformed search applies a way in which search tree is searched without any
information about the search space like initial state operators and test for the goal, so it is
also called blind search.
 It examines each node of the tree until it achieves the goal node.
It is divided into five main types:
o Breadth-first search
o Uniform cost search
o Depth-first search
o Iterative deepening depth-first search
o Bidirectional Search

Informed Search
 Informed search algorithms use domain knowledge. In an informed search, problem
information is available which guides the search.
 An informed search strategy finds a solution more efficiently than an uninformed search
strategy. Informed search is also called a Heuristic search.
 A heuristic is a way, which might not always be guaranteed for best solutions but
guaranteed to find a good solution in reasonable time.
 Informed search can solve much complex problem, which could not be solved in another
way.
Informed search algorithms is categorized into two types
1. Greedy Search
2. A* Search

Difference between Informed and Uninformed Search


S
Chapter 3: Popular Search Algorithms

Informed Search Uninformed Search

It does not use knowledge for searching


It uses knowledge for the searching process. process.

It finds solution slow as compared to informed


It finds solution more quickly. search.

It may or may not be complete. It is always complete.

Cost is low. Cost is high.

It consumes less time. It consumes moderate time.

It provides the direction regarding the No suggestion is given regarding the solution in
solution. it.

It is less lengthy while implementation. It is more lengthy while implementation.

Greedy Search, A* Search, Graph Search Depth First Search, Breadth First Search

Types of uninformed search algorithms:

1. Breadth-first Search
2. Depth-first Search

Breadth-first Search:
 Breadth-first search is the most common search strategy for traversing a tree or graph. This
algorithm searches breadth wise in a tree or graph, so it is called breadth-first search.
 BFS algorithm starts searching from the root node of the tree and expands all successor nodes at
the current level before moving to nodes of next level.
 The breadth-first search algorithm is an example of a general-graph search algorithm.
 Breadth-first search implemented using FIFO queue data structure.
S
Chapter 3: Popular Search Algorithms

Advantages:
 BFS will provide a solution if any solution exists.
 If there is more than one solution for a given problem, then BFS will provide the minimal
solution, which requires the least number of steps.
Disadvantages:
 It requires lots of memory since each level of the tree must be saved into memory to
expand the next level.
 BFS needs lots of time if the solution is far away from the root node.

Example:

In the below tree structure, the traversing of the tree using BFS algorithm from the root node S to
goal node K is performed. BFS search algorithm traverse in layers, so it will follow the path,
which is shown by the dotted arrow, and the traversed path will be:

S---> A--->B---->C--->D---->G--->H--->E---->F---->I- - ->K


S
Chapter 3: Popular Search Algorithms

 Time Complexity: Time Complexity of BFS algorithm is obtained by the number of nodes
traversed in BFS until the shallowest Node.
Where d= depth of shallowest solution
b is a node at every state.

T (b) = 1+b2+b3+...+ bd= O (bd)

 Space Complexity: Space complexity of BFS algorithm is given by the Memory size which is

given by O(bd)
 Completeness: BFS is complete, which means if the shallowest goal node is at some finite
depth, then BFS will find a solution.
 Optimality: BFS is optimal if path cost is a non-decreasing function of the depth of the node.

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 and the process of the DFS algorithm is
similar to the BFS algorithm.
Note: Backtracking is an algorithm technique for finding all possible solutions using recursion.

Advantage:

 DFS requires very less memory as it only needs to store a stack of the nodes on the path from root
node to the current node.
 It takes less time to reach to the goal node than BFS algorithm (if it traverses in the right path).

Disadvantage:

 There is the possibility that many states keep re-occurring, and there is no guarantee of finding the
solution.
 DFS algorithm goes for deep down searching and sometime it may go to the infinite loop.
S
Chapter 3: Popular Search Algorithms

Example:

 In the below search tree, it will follow the order as: Root node--->Left node > right node.
 It 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.

 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)
S
Chapter 3: Popular Search Algorithms

 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.

Informed Search Algorithms

The informed search algorithm is more useful for large search space. Informed search algorithm
uses the idea of heuristic, so it is also called Heuristic search.

Heuristics function:

 Heuristic is a function which is used in Informed Search, and it finds the most promising path. It
takes the current state of the agent as its input and produces the estimation of how close agent is
from the goal.
 The heuristic method, might not always give the best solution, but it guaranteed to find a good
solution in reasonable time.
 Heuristic function estimates how close a state is to the goal.
 It is represented by h (n), and it calculates the cost of an optimal path between the pair of states.
The value of the heuristic function is always positive.
Admissibility of the heuristic function is given as:

h (n) <= h*(n)

Where h(n) is heuristic cost, and h*(n) is the estimated cost.

Hence heuristic cost should be less than or equal to the estimated cost.

Best-first Search Algorithm (Greedy 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.
 The greedy best first algorithm is implemented by the priority queue.
S
Chapter 3: Popular Search Algorithms

 In the best first search algorithm, expand the node which is closest to the goal node and the
closest cost is estimated by heuristic function, i.e.f(n)= h(n).

Best first search algorithm:


 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 function f(n), and then
check if the node has been in either OPEN or CLOSED list. If the node has not been in both
lists, then add it to the OPEN list.
 Step 7: Return to Step 2.

Advantages:
 Best first search can switch between BFS and DFS by gaining the advantages of both the
algorithms.
 This algorithm is more efficient than BFS and DFS algorithms.

Disadvantages:
 It can behave as an unguided depth-first search in the worst case scenario.
 It can get stuck in a loop as DFS.
 This algorithm is not optimal.

Example:
Consider the below search problem, 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.
S
Chapter 3: Popular Search Algorithms

In this search example, two lists are created, which are OPEN and CLOSED Lists.
Following are the iteration for traversing the above example.
S
Chapter 3: Popular Search Algorithms

Expand the nodes of S and put in the CLOSED

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

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

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

Iteration3: 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.

A* Search Algorithm:

 A* search is the most commonly known form of best-first search.


 It uses heuristic function h(n), and cost to reach the node n from the start state g(n).
 A* search algorithm finds the shortest path through the search space using the heuristic function.
This search algorithm expands less search tree and provides optimal result faster.
 In A* search algorithm, search heuristic as well as the cost to reach the node is used. Hence can
combine both costs as following, and sum is called as a fitness number.
S
Chapter 3: Popular Search Algorithms

Algorithm of A* search:

Step1: Place the starting node in the OPEN list.

Step 2: Check if the OPEN list is empty or not, if the list is empty then return failure and stops.

Step 3: Select the node from the OPEN list which has the smallest value of evaluation function ,
if node n is goal node then return success and stop, otherwise

Step 4: Expand node n and generate all of its successors, and put n into the closed list. For each
successor n', check whether n' is already in the OPEN or CLOSED list, if not then compute
evaluation function for n' and place into Open list.

Step 5: Else if node n' is already in OPEN and CLOSED, then it should be attached to the back
pointer which reflects the lowest g(n') value.

Step 6: Return to Step 2.

Advantages:
 A* search algorithm is the best algorithm than other search algorithms.
 A* search algorithm is optimal and complete.
 This algorithm can solve very complex problems.

Disadvantages:
 It does not always produce the shortest path as it mostly based on heuristics and
approximation.
 A* search algorithm has some complexity issues.
 The main drawback of A* is memory requirement as it keeps all generated nodes in the
memory, so it is not practical for various large-scale problems.

Example:
The heuristic value of all states is given in the below table. Calculate the f(n) of each state using
the formula f(n)= g(n) + h(n), where g(n) is the cost to reach any node from start state.
S
Chapter 3: Popular Search Algorithms

Solution:
S
Chapter 3: Popular Search Algorithms

Initialization: {(S, 5)}

Iteration1: {(S--> A, 4), (S-->G, 10)}

Iteration2: {(S--> A-->C, 4), (S--> A-->B, 7), (S-->G, 10)}

Iteration3: {(S--> A-->C--->G, 6), (S--> A-->C--->D, 11), (S--> A-->B, 7), (S-->G, 10)}

Iteration 4 will give the result, as S--->A--->C--->G it provides the optimal path with cost 6.

Points to remember:

 A* algorithm returns the path which occurred first, and it does not search for all
remaining paths.
 The efficiency of A* algorithm depends on the quality of heuristic.

Complete: A* algorithm is complete as long as:

 Branching factor is finite.


 Cost at every action is fixed.

Optimal: If the heuristic function is admissible, then A* tree search will always find the least
cost path.

If the heuristic function is admissible, then A* tree search will always find the least cost path.

Time Complexity: The time complexity of A* search algorithm depends on heuristic function,
and the number of nodes expanded is exponential to the depth of solution d. So the time
complexity is O(bd), where b is the branching factor.

Space Complexity: The space complexity of A* search algorithm is O(bd)

Hill Climbing Algorithm in Artificial Intelligence

 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.
 Hill climbing algorithm is a technique, which is used for optimizing the mathematical problems.
S
Chapter 3: Popular Search Algorithms

 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.

Features of Hill Climbing:


 Generate and Test variant: Hill Climbing is the variant of Generate and Test method. The
Generate and Test method produce feedback, which helps to decide which direction to move in
the search space.
 Greedy approach: Hill-climbing algorithm search moves in the direction, which optimizes the
cost.
 No backtracking: It does not backtrack the search space, as it does not remember the previous
states.

State-space Diagram for Hill Climbing:

The state-space landscape is a graphical representation of the hill-climbing algorithm which is


showing a graph between various states of algorithm and Objective function/Cost.

Algorithm
S
Chapter 3: Popular Search Algorithms

Different regions in the state space landscape:

 Local Maximum: Local maximum is a state, which is better than its neighbor states, but
there is also another state, which is higher than it.
 Global Maximum: Global maximum is the best possible state of state space landscape.
It has the highest value of objective function.
 Current state: It is a state in a landscape diagram where an agent is currently present.
 Flat local maximum: It is a flat space in the landscape where all the neighbor states of
current states have the same value.
 Shoulder: It is a plateau region, which has an uphill edge.

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.
S
Chapter 3: Popular Search Algorithms

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.
S
Chapter 3: Popular Search Algorithms

Simulated Annealing:
 A hill-climbing algorithm, which never makes a move towards a lower value, guaranteed to be
incomplete because it can get stuck on a local maximum. In addition, if algorithm applies a
random walk, by moving a successor, then it may complete but not efficient.
 Simulated Annealing is an algorithm, which yields both efficiency and completeness.
 In mechanical term Annealing is a process of hardening a metal or glass to a high temperature
then cooling gradually, so this allows the metal to reach a low-energy crystalline state. The
same process is used in simulated annealing in which the algorithm picks a random move,
instead of picking the best move.
 If the random move improves the state, then it follows the same path. Otherwise, the algorithm
follows the path which has a probability of less than 1 or it moves downhill and chooses
another path.

Advantages of Simulated Annealing

 Can deal with arbitrary systems and cost functions


 Is relatively easy to code, even for complex problems
 Generally gives a "good" solution.

Disadvantages of Simulated Annealing


S
Chapter 3: Popular Search Algorithms

 Many choices are required to turn it into an actual algorithm.

 there is a clear tradeoff between the quality of the solutions and the time required to compute
them

Local Beam Search Algorithm

 In this algorithm, it holds k number of states at any given time. At the start, these states are
generated randomly. The successors of these k states are computed with the help of objective
function. If any of these successors is the maximum value of the objective function, then the
algorithm stops.

 Otherwise the (initial k states and k number of successors of the states = 2k) states are placed in a
pool. The pool is then sorted numerically. The highest k states are selected as new initial states.
This process continues until a maximum value is reached.
S
Chapter 3: Popular Search Algorithms

Algorithm

1. Keep track of k states rather than just one.


2. Start with K randomly generated states.
3. At Each Iteration, all the successors of all k states are generated.
4. If any one is a goal state, stop else select the k best successors from the complete list and repeat.

Travelling Salesman Problem


In this algorithm, the objective is to find a low-cost tour that starts from a city, visits all cities
en-route exactly once and ends at the same starting city.
1. Start
2. Find out all (n -1)! Possible solutions, where n is the total number of cities.
3. Determine the minimum cost by finding out the cost of each of these (n -1)! solutions.
4. Finally, keep the one with the minimum cost.
5. end
S
Chapter 4: Fuzzy logic Systems

Chapter 4 Fuzzy logic Systems


Definition: Fuzzy Logic (FL) is a method of reasoning that resembles human reasoning. This approach is
similar to how humans perform decision-making. And it involves all intermediate possibilities
between YES and NO.

Lotfi Zadeh invented the Fuzzy logic.

 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 human decision making includes a range of possibilities between YES and NO, such as

CERTAINLY YES
POSSIBLY YES
CANNOT SAY
POSSIBLY NO
S
Chapter 4: Fuzzy logic Systems

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.

 It can be implemented in hardware, software, or a combination of both.

Why Fuzzy Logic?

Fuzzy logic is useful for commercial and practical purposes.

 It can control machines and consumer products.


 It may not give accurate reasoning, but acceptable reasoning.
 Fuzzy logic helps to deal with the uncertainty in engineering.

Fuzzy Logic Architecture

The fuzzy logic architecture consists of four main parts:


S
Chapter 4: Fuzzy logic Systems

Rule base: It contains the set of rules and the IF-THEN conditions provided by the experts to
govern the decision-making system, based on linguistic information. Recent developments in
fuzzy theory offer several effective methods for the design and tuning of fuzzy controllers.

Fuzzification – This step converts inputs or the crisp numbers into fuzzy sets. You can measure
the crisp inputs by sensors and pass them into the control system for further processing. It splits the
input signal into five steps such as

Inference Engine: It determines the degree of match between fuzzy input and the rules.
According to the input field, it will decide the rules that are to be fired. Combining the fired
rules, form the control actions.

Defuzzification – The Defuzzification process converts the fuzzy sets into a crisp value. There
are different types of techniques available, and need to select the best-suited one with an expert
system.

Fuzzy Logic vs Probability

Fuzzy Logic Probability


In fuzzy logic, captures the essential concept of Probability is associated with events and not
vagueness. facts, and those events will either occur or not
occur
Fuzzy Logic captures the meaning of partial Probability theory captures partial knowledge
truth
Fuzzy logic takes truth degrees as a Probability is a mathematical model of
mathematical basis. ignorance
S
Chapter 4: Fuzzy logic Systems

Applications of Fuzzy Logic


The Fuzzy logic is used in various fields such as automotive systems, domestic goods,
environment control, etc. Some of the common applications are:

 It is used in the aerospace field for altitude control of spacecraft and satellite.
 This controls the speed and traffic in the automotive systems.
 It is used for decision-making support systems and personal evaluation in the large
company business.
 It also controls the pH, drying, chemical distillation process in the chemical industry.
 Fuzzy logic is used in Natural language processing and various intensive applications in
Artificial Intelligence.
 It is extensively used in modern control systems such as expert systems.
 Fuzzy Logic mimics how a person would make decisions, only much faster and used in
Neural Networks.

Advantages of Fuzzy Logic System


 This system can work with any type of inputs whether it is imprecise, distorted or noisy input
information.
 The construction of Fuzzy Logic Systems is easy and understandable.
 Fuzzy logic comes with mathematical concepts of set theory and the reasoning of that is quite
simple.
 It provides a very efficient solution to complex problems in all fields of life, as it resembles
human reasoning and decision-making.
 The algorithms can be described with little data, so little memory is required.
 Can be easily modified it to improve or alter system performance.
 Inexpensive sensors can be used which helps you to keep the overall system cost and
complexity low.
Disadvantages of Fuzzy Logic System
 Fuzzy logic is not always accurate. So the results are perceived based on assumptions and
may not be widely accepted
 It cannot recognize machine learning as-well-as neural network type patterns
S
Chapter 4: Fuzzy logic Systems

 Validation and Verification of a fuzzy knowledge-based system needs extensive


testing with hardware.
 Setting exact, fuzzy rules and, membership functions is a difficult task.
 At times, the fuzzy logic is confused with probability theory.

Membership Function

The membership function is a graph that defines how each point in the input space is mapped to
membership value between 0 and 1. It allows you to quantify linguistic terms and represent a
fuzzy set graphically. A membership function for a fuzzy set A on the universe of discourse X is
defined as μA:X → [0,1]

It quantifies the degree of membership of the element in X to the fuzzy set A.

 x-axis represents the universe of discourse.


 y-axis represents the degrees of membership in the [0, 1] interval.

Fuzzy Logic in AI: Example

The design of a fuzzy logic system starts with a set of membership functions for each input and a
set for each output. A set of rules is then applied to the membership functions to yield a crisp
output value.

Algorithm

 Define linguistic Variables and terms (start)


 Construct membership functions for them. (start)
 Construct knowledge base of rules (start)
 Convert crisp data into fuzzy data sets using membership functions. (fuzzification)
 Evaluate rules in the rule base. (Inference Engine)
 Combine results from each rule. (Inference Engine)
 Convert output data into non-fuzzy values. (defuzzification)
S
Chapter 4: Fuzzy logic Systems

Development
Step 1 − Define linguistic variables and terms
Linguistic variables are input and output variables in the form of simple words or sentences. For
room temperature, cold, warm, hot, etc., are linguistic terms.
Temperature (t) = {very-cold, cold, warm, very-warm, hot}
Every member of this set is a linguistic term and it can cover some portion of overall
temperature values.
Step 2 − Construct membership functions for them
The membership functions of temperature variable are as shown
Step3 − Construct knowledge base rules
Create a matrix of room temperature values versus target temperature values that an air
conditioning system is expected to provide.
Build a set of rules into the knowledge base in the form of IF-THEN-ELSE structures.

Condition Action

IF temperature=(Cold OR Very_Cold) AND target=Warm THEN Heat

IF temperature=(Hot OR Very_Hot) AND target=Warm THEN Cool

IF (temperature=Warm) AND (target=Warm) THEN No_Change

Step 4 − Obtain fuzzy value


Fuzzy set operations perform evaluation of rules. The operations used for OR and AND are
Max and Min respectively. Combine all results of evaluation to form a final result. This result is
a fuzzy value.

Step 5 − Perform defuzzification


Defuzzification is then performed according to membership function for output variable.
S
Chapter 4: Fuzzy logic Systems
Chapter 5 Natural Language Processing

Unit 5 NATURAL LANGUAGE PROCESSING


Introduction
Natural Language Processing (NLP) refers to AI method of communicating with intelligent
systems using a natural language such as English.
Processing of Natural Language is required when an intelligent system like robot to perform
as per the instructions. 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 −

Natural Language Understanding (NLU)

Understanding involves the following tasks −

 Mapping the given input in natural language into useful representations.


 Analyzing different aspects of the language.

Natural Language Generation (NLG)

It is the process of producing meaningful phrases and sentences in the form of natural
language from some internal representation.
It involves −
 Text planning − It includes retrieving the relevant content from knowledge base.
 Sentence planning − It includes choosing required words, forming meaningful
phrases, setting tone of the sentence.
 Text Realization − It is mapping sentence plan into sentence structure.
The NLU is harder than NLG.

Difficulties in NLU

NL has an extremely rich form and structure.


It is very ambiguous. There can be different levels of ambiguity −
 Lexical ambiguity − It is at very primitive level such as word-level.
 For example, treating the word “board” as noun or verb?
 Syntax Level ambiguity − A sentence can be parsed in different ways.
Chapter 5 Natural Language Processing

 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?
 Referential ambiguity − Referring to something using pronouns. For example, Rima
went to Gauri. She said, “I am tired.” − Exactly who is tired?
 One input can mean different meanings.
 Many inputs can mean the same thing.

NLP Terminology
 Phonology − It is study of organizing sound systematically.
 Morphology − It is a study of construction of words from primitive meaningful units.
 Morpheme − It is primitive unit of meaning in a language.
Syntax − It refers to arranging words to make a sentence. It also involves determining the structural r
Semantics − It is concerned with the meaning of words and how to combine words into meaningful phr
Pragmatics − It deals with using and understanding sentences in different situations and how the interpr
Discourse − It deals with how the immediately preceding sentence can affect the interpretation of the
World Knowledge − It includes the general knowledge about the world.
Tokenization- Tokenization is, generally, an early step in the NLP process, a step which splits longer stri
Normalization Normalization generally refers to a series of related tasks meant to put all text on a level p

equivalents, and so on.


 Stemming Stemming is the process of eliminating affixes (suffixed, prefixes, infixes,
circumfixes) from a word in order to obtain a word stem.
Example running → run
 Lemmatization Lemmatization is related to stemming, differing in that
lemmatization is able to capture canonical forms based on a word's lemma.
Example better → good
Chapter 5 Natural Language Processing

 Stop Words Stop words are those words which are filtered out before further processing
of text, since these words contribute little to overall meaning. For instance, "the," "and,"
and
"a," while all required words in a particular passage.
 Parts-of-speech (POS) Tagging
POS tagging consists of assigning a category tag to the tokenized parts of a sentence.
The most popular POS tagging would be identifying words as nouns, verbs, adjectives,
etc.

 Corpus In linguistics and NLP, corpus (literally Latin for body) refers to a collection of
texts. Such collections may be formed of a single language of texts, or can span multiple
languages -- there are numerous reasons for which multilingual corpora (the plural of
corpus) may be useful.
Steps in NLP

 Lexical Analysis − It involves identifying and analyzing the structure of words.


Lexicon of a language means the collection of words and phrases in a language.
Lexical analysis is dividing the whole chunk of txt into paragraphs, sentences, and
words.
 Syntactic Analysis (Parsing) − It involves analysis of words in the sentence for
grammar and arranging words in a manner that shows the relationship among the
words. The sentence such as “The school goes to boy” is rejected by English
syntactic analyzer.
 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”.
 Discourse Integration − The meaning of any sentence depends upon the meaning of
the sentence just before it. In addition, it also brings about the meaning of
Chapter 5 Natural Language Processing

immediately succeeding sentence.


Chapter 5 Natural Language Processing

 Pragmatic Analysis − During this, what was said is re-interpreted on what it actually
meant. It involves deriving those aspects of language which require real world
knowledge.

Implementation Aspects of Syntactic Analysis


It consist of two methods

 Context-Free Grammar
 Top-Down Parser

Context-Free Grammar

It is the grammar that consists rules with a single symbol on the left-hand side of the rewrite
rules.
“The bird pecks the grains”
Articles (DET) − a | an | the
Nouns − bird | birds | grain | grains
Noun Phrase (NP) − Article + Noun | Article + Adjective + Noun
= DET N | DET ADJ N
Verbs − pecks | pecking | pecked
Verb Phrase (VP) − NP V | V NP
Adjectives (ADJ) − beautiful | small | chirping
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.
. 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
NP → DET N | DET ADJ N
VP → V NP
Lexocon −
DET → a | the
ADJ → beautiful | perching
N → bird | birds | grain | grains
V → peck | pecks | pecking
The parse tree can be created as shown –
Chapter 5 Natural Language Processing

Merit − The simplest style of grammar, therefore widely used one.


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.
 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 −
Chapter 5 Natural Language Processing

 It is inefficient, as the search process has to be repeated if an error occurs.


 Slow speed of working.
ARTIFICIAL INTELLIGENCE BCA

Unit 6 Expert systems


Introduction
The expert systems are the computer applications developed to solve complex problems in a
particular domain, at the level of extra-ordinary human intelligence and expertise.

Characteristics of Expert Systems

 High performance

 Understandable
 Reliable

 Highly responsive

Capabilities of Expert Systems


 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

 Substituting human decision makers


 Possessing human capabilities

 Producing accurate output for inadequate knowledge base

 Refining their own knowledge

Components of Expert Systems


ARTIFICIAL INTELLIGENCE BCA

 Knowledge Base
 Inference Engine

 User Interface

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.

Knowledge Definition

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.

Components of Knowledge Base

The knowledge base of an ES is a store of both, factual and heuristic knowledge.

 Factual Knowledge − It is the information widely accepted by the Knowledge


Engineers and scholars in the task domain.
ARTIFICIAL INTELLIGENCE BCA

 Heuristic Knowledge − It is about practice, accurate judgement, one’s ability of


evaluation, and guessing.

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

The success of expert system 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.

He acquires information from subject expert by recording, interviewing, and observing him
at work, etc. He then categorizes and organizes the information in a meaningful way, in the
form of IF-THEN-ELSE rules, to be used by interference machine. The knowledge engineer
also monitors the development of the ES.

Inference Engine
Use of efficient procedures and rules by the Inference Engine is essential in deducting a
correct, flawless solution.

In case of knowledge-based ES, the Inference Engine acquires and manipulates the
knowledge from the knowledge base to arrive at a particular solution.

In case of rule based ES, it −

 Applies rules repeatedly to the facts, which are obtained from earlier rule application.

 Adds new knowledge into the knowledge base if required.

 Resolves rules conflict when multiple rules are applicable to a particular case.

The Inference Engine uses the following strategies

 Forward Chaining
 Backward Chaining
ARTIFICIAL INTELLIGENCE BCA

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.

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.
ARTIFICIAL INTELLIGENCE BCA

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.

It explains how the ES has arrived at a particular recommendation. The


explanation may appear in the following forms −

 Natural language displayed on screen.


 Verbal narrations in natural language.
 Listing of rule numbers displayed on the screen.

The user interface makes it easy to trace the credibility of the deductions.

Requirements of Efficient ES User Interface

 It should help users to accomplish their goals in shortest possible way.

 It should be designed to work for user’s existing or desired work practices.

 Its technology should be adaptable to user’s requirements; not the other way round.

 It should make efficient use of user input.

Expert Systems Limitations


 Limitations of the technology
 Difficult knowledge acquisition

 ES are difficult to maintain


 High development costs

Applications of Expert System

o In designing and manufacturing domain


ARTIFICIAL INTELLIGENCE BCA

o It can be broadly used for designing and manufacturing physical devices such as

camera lenses and automobiles.

o In the knowledge domain


These systems are primarily used for publishing the relevant knowledge to the users.

The two popular ES used for this domain is an advisor and a tax advisor.

o In the finance domain


In the finance industries, it is used to detect any type of possible fraud, suspicious

activity, and advise bankers that if they should provide loans for business or not.

o In the diagnosis and troubleshooting of devices


In medical diagnosis, the ES system is used, and it was the first area where these

systems were used.

o Planning and scheduling


The expert systems can also be used for planning and scheduling some particular

tasks for achieving the goal of that task.

Expert System Technology

 Expert System Development Environment − The ES development


environment includes hardware and tools. They are

o Workstations, minicomputers, mainframes.

o High level Symbolic Programming Languages such as LIST Programming


(LISP) and PROgrammation en LOGique

o (PROLOG).

o Large databases.

 Tools − They reduce the effort and cost involved in developing an expert system to
large extent.
ARTIFICIAL INTELLIGENCE BCA

o Powerful editors and debugging tools with multi-windows.

o They provide rapid prototyping

o Have Inbuilt definitions of model, knowledge representation, and inference


design.

 Shells − A shell is nothing but an expert system without knowledge base. A shell
provides the developers with knowledge acquisition, inference engine, user interface,
and explanation facility. For example, few shells are given below −

o Java Expert System Shell (JESS) that provides fully developed Java API for
creating an expert system.

o Vidwan, a shell developed at the National Centre for Software Technology,


Mumbai in 1993. It enables knowledge encoding in the form of IF-THEN
rules.

Development of Expert Systems: General Steps


The process of ES development is iterative. Steps in developing the ES include −

Identify Problem Domain


 The problem must be suitable for an expert system to solve it.
 Find the experts in task domain for the ES project.
 Establish cost-effectiveness of the system.

Design the System


 Identify the ES Technology

 Know and establish the degree of integration with the other systems and databases.

 Realize how the concepts can represent the domain knowledge best.

Develop the Prototype


From Knowledge Base: The knowledge engineer works to −

 Acquire domain knowledge from the expert.


 Represent it in the form of If-THEN-ELSE rules.
ARTIFICIAL INTELLIGENCE BCA

Test and Refine the Prototype


 The knowledge engineer uses sample cases to test the prototype for any deficiencies
in performance.
 End users test the prototypes of the ES.

Develop and Complete the ES


 Test and ensure the interaction of the ES with all elements of its environment,
including end users, databases, and other information systems.

 Document the ES project well.

 Train the user to use ES.

Maintain the System


 Keep the knowledge base up-to-date by regular review and update.
 Cater for new interfaces with other information systems, as those systems evolve.

Benefits of Expert Systems


 Availability − They are easily available due to mass production of software.
 Less Production Cost − Production cost is reasonable. This makes them affordable.
 Speed − They offer great speed. They reduce the amount of work an individual puts
in.
 Less Error Rate − Error rate is low as compared to human errors.
 Reducing Risk − They can work in the environment dangerous to humans.
 Steady response − They work steadily without getting motional, tensed or fatigued.
ARTIFICIAL INTELLIGENCE BCA

Unit 7 ROBOTICS
Introduction
Robots are the artificial agents acting in real world environment.

Objective
Robots are aimed at manipulating the objects by perceiving, picking, moving, modifying the
physical properties of object, destroying it, or to have an effect thereby freeing manpower
from doing repetitive functions without getting bored, distracted, or exhausted.

What is Robotics?
Robotics is a branch of AI, which is composed of Electrical Engineering, Mechanical
Engineering, and Computer Science for designing, construction, and application of robots.

Aspects of Robotics
 The robots have mechanical construction, form, or shape designed to accomplish a
particular task.

 They have electrical components which power and control the machinery.

 They contain some level of computer program that determines what, when and how
a robot does something.

Difference in Robot System and Other AI Program

AI PROGRAMS ROBOTS

They usually operate in computer- They operate in real physical world


stimulated worlds.

The input to an AI program is in Inputs to robots is analog signal in


symbols and rules. the form of speech waveform or
images
They need general purpose computers to They need special hardware with
operate on sensors and effectors.

Robot Locomotion
Locomotion is the mechanism that makes a robot capable of moving in its environment.
ARTIFICIAL INTELLIGENCE BCA

There are various types of locomotions −

 Legged
 Wheeled
 Combination of Legged and Wheeled Locomotion
 Tracked slip/skid

Legged Locomotion

 This type of locomotion consumes more power while demonstrating walk, jump, trot,
hop, climb up or down, etc.

 It requires more number of motors to accomplish a movement. It is suited for rough


as well as smooth terrain where irregular or too smooth surface makes it consume
more power for a wheeled locomotion. It is little difficult to implement because of
stability issues.

 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.

The total number of possible gaits (a periodic sequence of lift and release events for each of
the total legs) a robot can travel depends upon the number of its legs.

If a robot has k legs, then the number of possible events N = (2k-1)!.

In case of a two-legged robot (k=2), the number of possible events is N = (2k-1)! = (2*2-1)!
= 3! = 6.

Hence there are six possible different events −

 Lifting the Left leg

 Releasing the Left leg

 Lifting the Right leg

 Releasing the Right leg

 Lifting both the legs together

 Releasing both the legs together


ARTIFICIAL INTELLIGENCE BCA

Wheeled Locomotion
It requires fewer numbers of motors to accomplish a movement. It is little easy to implement
as there are less stability issues in case of more number of wheels. It is power efficient as
compared to legged locomotion.

 Standard wheel − Rotates around the wheel axle and around the contact

 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.

 Ball or spherical wheel − Omnidirectional wheel, technically difficult to implement.

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.
ARTIFICIAL INTELLIGENCE BCA

Components of a Robot

 Power Supply − The robots are powered by batteries, solar power, hydraulic, or
pneumatic power sources.

 Actuators − They convert energy into movement.

 Electric motors (AC/DC) − They are required for rotational movement.

 Pneumatic Air Muscles − They contract almost 40% when air is sucked in them.

 Muscle Wires − They contract by 5% when electric current is passed through them.

 Piezo Motors and Ultrasonic Motors − Best for industrial robots.

 Sensors − They provide knowledge of real time information on the task environment.
Robots are equipped with vision sensors to be to compute the depth in the
environment. A tactile sensor imitates the mechanical properties of touch receptors
of human fingertips.

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.

Computer vision automatically extracts, analyzes, and comprehends useful information from
a single image or an array of images. This process involves development of algorithms to
accomplish automatic visual comprehension.

Hardware of Computer Vision System

 Power supply

 Image acquisition device such as camera


ARTIFICIAL INTELLIGENCE BCA

 A processor

 A software

 A display device for monitoring the system

 Accessories such as camera stands, cables, and connectors

Tasks of Computer Vision

 OCR − In the domain of computers, Optical Character Reader, a software to convert


scanned documents into editable text, which accompanies a scanner.

 Face Detection − Many state-of-the-art cameras come with this feature, which
enables to read the face and take the picture of that perfect expression. It is used to
let a user access the software on correct match.

 Object Recognition − They are installed in supermarkets, cameras, high-end cars


such as BMW, GM, and Volvo.

 Estimating Position − It is estimating position of an object with respect to camera as


in position of tumour in human’s body.

Application Domains of Computer Vision

 Agriculture

 Autonomous vehicles

 Biometrics

 Character recognition

 Forensics, security, and surveillance

 Industrial quality inspection

 Face recognition

 Gesture analysis

 Geoscience

 Medical imagery

 Pollution monitoring

 Process control
ARTIFICIAL INTELLIGENCE BCA

 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.

 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.

 Exploration − The robot rock climbers used for space exploration, underwater
drones used for ocean exploration are to name a few.

 Entertainment − Disney’s engineers have created hundreds of robots for movie


making.
ARTIFICIAL INTELLIGENCE BCA

Unit 7 NEURAL NETWORKS


Artificial Neural Networks (ANNs)

The inventor of the first neurocomputer, 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.”

Basic Structure of ANNs


The idea of ANNs is based on the belief that working of human brain by making the right
connections can be imitated using silicon and wires as living neurons and dendrites.

The human brain is composed of 86 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.
ARTIFICIAL INTELLIGENCE BCA

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.

Each link is associated with weight. ANNs are capable of learning, which takes place by
altering weight values. The following illustration shows a simple ANN −

Types of Artificial Neural Networks

There are two Artificial Neural Network topologies − FeedForward and Feedback.

FeedForward ANN

In this ANN, the information flow is unidirectional. A unit sends information to other unit
from which it does not receive any information. There are no feedback loops. They are used
in pattern generation/recognition/classification. They have fixed inputs and outputs.
ARTIFICIAL INTELLIGENCE BCA

FeedBack ANN

Here, feedback loops are allowed. They are used in content addressable memories.
ARTIFICIAL INTELLIGENCE BCA

Working of ANNs
In the topology diagrams shown, each arrow represents a connection between two neurons
and indicates the pathway for the flow of information. Each connection has a weight, an
integer number that controls the signal between the two neurons.

If the network generates a “good or desired” output, there is no need to adjust the weights. If
the network generates a “poor or undesired” output or an error, then the system alters the
weights in order to improve subsequent results.

Machine Learning in ANNs

ANNs are capable of learning and they need to be trained. There are several learning
strategies −

 Supervised Learning − It involves a teacher that is scholar than the ANN itself. For
example, the teacher feeds some example data about which the teacher already
knows the answers.
ARTIFICIAL INTELLIGENCE BCA

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.

 Unsupervised Learning − It is required when there is no example data set with


known answers. For example, searching for a hidden pattern. In this case, clustering
i.e. dividing a set of elements into groups according to some unknown pattern is
carried out based on the existing data sets present.

 Reinforcement Learning − This strategy built on observation. The ANN makes a


decision by observing its environment. If the observation is negative, the network
adjusts its weights to be able to make a different required decision the next time.

Bayesian Networks (BN)


These are the graphical structures used to represent the probabilistic relationship among a set
of random variables. Bayesian networks are also called Belief Networks or Bayes
Nets. BNs reason about uncertain domain.

In these networks, each node represents a random variable with specific propositions. For
example, in a medical diagnosis domain, the node Cancer represents the proposition that a
patient has cancer.

The edges connecting the nodes represent probabilistic dependencies among those random
variables. If out of two nodes, one is affecting the other then they must be directly connected
in the directions of the effect. The strength of the relationship between variables is
quantified by the probability associated with each node.

There is an only constraint on the arcs in a BN that you cannot return to a node simply by
following directed arcs. Hence the BNs are called Directed Acyclic Graphs (DAGs).

BNs are capable of handling multivalued variables simultaneously. The BN variables are
composed of two dimensions −

 Range of prepositions

 Probability assigned to each of the prepositions.


ARTIFICIAL INTELLIGENCE BCA

Consider a finite set X = {X1, X2, …,Xn} of discrete random variables, where each
variable Xi may take values from a finite set, denoted by Val(Xi). If there is a directed link
from variable Xi to variable, Xj, then variable Xi will be a parent of variable Xj showing direct
dependencies between the variables.

The structure of BN is ideal for combining prior knowledge and observed data. BN can be
used to learn the causal relationships and understand various problem domains and to predict
future events, even in case of missing data.

Building a Bayesian Network

A knowledge engineer can build a Bayesian network. There are a number of steps the
knowledge engineer needs to take while building it.

Example problem − Lung cancer. A patient has been suffering from breathlessness. He
visits the doctor, suspecting he has lung cancer. The doctor knows that barring lung cancer,
there are various other possible diseases the patient might have such as tuberculosis and
bronchitis.

Gather Relevant Information of Problem

 Is the patient a smoker? If yes, then high chances of cancer and bronchitis.

 Is the patient exposed to air pollution? If yes, what sort of air pollution?

 Take an X-Ray positive X-ray would indicate either TB or lung cancer.

Identify Interesting Variables

The knowledge engineer tries to answer the questions −

 Which nodes to represent?

 What values can they take? In which state can they be?

For now let us consider nodes, with only discrete values. The variable must take on exactly
one of these values at a time.

Common types of discrete nodes are −


 Boolean nodes − They represent propositions, taking binary values TRUE (T) and
FALSE (F).
ARTIFICIAL INTELLIGENCE BCA

 Ordered values − A node Pollution might represent and take values from {low,
medium, high} describing degree of a patient’s exposure to pollution.

Possible nodes and values for the lung cancer example −

Node Name Type Value

Polution Binary {LOW,


HIGH,
MEDIUM}

Smoker Boolean {TRUE,


FASLE}

Lung-Cancer Boolean {TRUE,


FASLE}

X-Ray Binary {Positive,


Negative}

Create Arcs between Nodes


Topology of the network should capture qualitative relationships between variables.

For example, what causes a patient to have lung cancer? - Pollution and smoking. Then add
arcs from node Pollution and node Smoker to node Lung-Cancer.

Similarly if patient has lung cancer, then X-ray result will be positive. Then add arcs from
node Lung-Cancer to node X-Ray.
ARTIFICIAL INTELLIGENCE BCA

Applications of Neural Networks

They can perform tasks that are easy for a human but difficult for a machine −
 Aerospace − Autopilot aircrafts, aircraft fault detection.

 Automotive − Automobile guidance systems.

 Military − Weapon orientation and steering, target tracking, object discrimination,


facial recognition, signal/image identification.

 Electronics − Code sequence prediction, IC chip layout, chip failure analysis,


machine vision, voice synthesis.

 Financial − Real estate appraisal, loan advisor, mortgage screening, corporate bond
rating, portfolio trading program, corporate financial analysis, currency value
prediction, document readers, credit application evaluators.

 Industrial − Manufacturing process control, product design and analysis, quality


inspection systems, welding quality analysis, paper quality prediction, chemical
product design analysis, dynamic modeling of chemical process systems, machine
maintenance analysis, project bidding, planning, and management.
ARTIFICIAL INTELLIGENCE BCA

 Medical − Cancer cell analysis, EEG and ECG analysis, prosthetic design, transplant
time optimizer.

 Speech − Speech recognition, speech classification, text to speech conversion.

 Telecommunications − Image and data compression, automated information


services, real-time spoken language translation.

 Transportation − Truck Brake system diagnosis, vehicle scheduling, routing


systems.
 Software − Pattern Recognition in facial recognition, optical character recognition,
etc.
 Time Series Prediction − ANNs are used to make predictions on stocks and natural
calamities.
 Signal Processing − Neural networks can be trained to process an audio signal and
filter it appropriately in the hearing aids.
 Control − ANNs are often used to make steering decisions of physical vehicles.
 Anomaly Detection − As ANNs are expert at recognizing patterns, they can also be
trained to generate an output when something unusual occurs that misfits the pattern.

You might also like