Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
15 views61 pages

AI Module 1 First

Uploaded by

rakshu78889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views61 pages

AI Module 1 First

Uploaded by

rakshu78889
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

Artificial Intelligence & Machine

Learning(20SCS12)
by
Saroj Kaushik
Chapter 1
Introduction to Artificial Intelligence

By,
Dr. Jyothi D G
Associate Professor & P G Coordinator
Department of CSE -BIT
Course outcomes:
Students will be able to
 Define AI and identify problems for AI. Characterize the search
techniques to solve problems and recognize the scope of classical
search techniques.

 Define Knowledge and its role in AI. Demonstrate the use of logic
in solving AI problems.

 Demonstrate handling of uncertain knowledge and reasoning in


probability theory.

 Understanding of Learning methods.


What is Artificial Intelligence?
• It is a branch of Computer Science that pursues creating the
computers or machines as intelligent as human beings.

• It is the science and engineering of making intelligent machines,


especially intelligent computer programs.

• Artificial intelligence (AI) refers to the simulation of


human intelligence in machines that are programmed to think
like humans and mimic their actions.

• According to the father of Artificial Intelligence, John


McCarthy, it is
“The science and engineering of making intelligent
machines, especially intelligent computer programs”.
2/10/2021 10:19 PM M.Tech-CSE-BIT 4
Continued..
• Artificial Intelligence is a way of making a computer, a
computer-controlled robot, or a software think
intelligently, in the similar manner the intelligent humans
think.
• AI is accomplished by studying how human brain thinks,
learn, decide and work while trying to solve a problem, and
then using the outcomes of this study as a basis of developing
intelligent software and systems.
• AI can perform tasks such as identifying patterns in the data
more efficiently than humans, enabling businesses to gain
more insight out of their data.

2/10/2021 10:19 PM M.Tech-CSE-BIT 5


Continued..

• From a business perspective AI is a set of very powerful


tools and methodologies for using those tools to solve
business problems.

• From a programming perspective, AI includes the study


of symbolic programming, problem solving, and search.

2/10/2021 10:19 PM M.Tech-CSE-BIT 6


Continued..

Mapping of Human brain


Human Brain
into machine

2/10/2021 10:19 PM M.Tech-CSE-BIT 7


Why study AI?

Search engines

Science

Medicine/
Diagnosis

Labor
Appliances
2/10/2021 10:19 PM M.Tech-CSE-BIT 8
Why study AI?
• Honda Humanoid Robot(In 1986, Honda started
research on Robot)

Walk

Turn

2/10/2021 10:19 PM M.Tech-CSE-BIT Stairs 9


Natural Language Question Answering(Is a CS
discipline within the fields of information retrieval and NLP, which is
concerned about building systems that automatically answer questions posted
by humans in a natural language)

http://aimovie.warnerbros.com http://www.ai.mit.edu/projects/infolab/
2/10/2021 10:19 PM M.Tech-CSE-BIT 10
Milestone in the field of Artificial Intelligence(In 1997, A
machine called Blue whale, IBM’s greatest creations beats Kasparov, top
ranking human in Chess. In 1989, Kasparov defeated earlier prototype of Blue
Whale called Chip Set. It took a decade to improve system. In 2017 TedTalk, he
shared favorable views on developing technology)

2/10/2021 10:19 PM M.Tech-CSE-BIT 11


Robot holding electric bulb

2/10/2021 10:19 PM M.Tech-CSE-BIT 12


Human vs Robot Table Tennis game(Ping
Pong playing Robot)

2/10/2021 10:19 PM M.Tech-CSE-BIT 13


Driver-less Car

2/10/2021 10:19 PM M.Tech-CSE-BIT 14


Smart Cars
• Self-driving cars are moving closer and closer to reality;
Google’s self-driving car project and Tesla’s “autopilot”
feature are two examples that have been in the news.
• Self-driving cars learn to drive in the same way that humans
do: through experience.
• Engineers have been attempting prototype of self driving cars
for decades. The idea behind it simple. Outfit car with sensors
that can track objects around it.
• Teaching in- car computers the rules of the road and set them
to navigate to their own destination.

2/10/2021 10:19 PM M.Tech-CSE-BIT 15


Examples of Artificial Intelligence -You’re
Using in Daily Life
• Virtual Personal Assistants
• Siri, Okay Google now are all intelligent digital
personal assistants on various platforms (iOS,
Android, and Windows Mobile).
• They help to find useful information when you ask
for it using your voice; you can say “Where’s the
nearest Indian restaurant?”, “What’s on my
schedule today?”, “Remind me to call Jerry at
eight o’clock,” .
• The assistant will respond by finding information,
relaying information from your phone, or sending
commands to other apps.
2/10/2021 10:19 PM M.Tech-CSE-BIT 16
Purchase Prediction
• Large retailers like Target and Amazon stand to
make a lot of money if they can anticipate your
needs.
• Amazon’s anticipatory shipping project hopes to
send you items before you need them, completely
obviating the need for a last-minute trip to the
online store.
• While that technology isn’t yet in place, brick-
and-mortar retailers are using the same ideas with
coupons; when you go to the store, you’re often
given a number of coupons that have been
selected by a predictive analytics algorithm.

2/10/2021 10:19 PM M.Tech-CSE-BIT 17


Fraud Detection
• Have you ever gotten an email or a letter asking you if you made
a specific purchase on your credit card?
• Many banks send these types of communications if they think
there’s a chance that fraud may have been committed on your
account, and want to make sure that you approve the purchase
before sending money over to another company.
• Artificial intelligence is the technology deployed to monitor for
this type of fraud.
• In many cases, computers are given a very large sample
of fraudulent and non-fraudulent purchases and asked to
learn to look for signs that a transaction falls into one
category or another.
• After enough training, the system will be able to spot a
fraudulent transaction based on the signs and indications
that it learned through the training exercise.
2/10/2021 10:19 PM M.Tech-CSE-BIT 18
Security Surveillance
• A single person monitoring a number of video cameras
isn’t a very secure system; people get bored easily, and
keeping track of multiple monitors can be difficult even
in the best of circumstances.
• Computers are trained to monitor those cameras.
• With supervised training exercises, security algorithms
can take input from security cameras and determine
whether there may be a threat—if it “sees” a warning
sign, it will alert human security officers.

2/10/2021 10:19 PM M.Tech-CSE-BIT 19


Smart Home Devices
• Many smart home devices now include the ability to
learn your behavior patterns and help you save money
by adjusting the settings on your thermostat or other
appliances in an effort to increase convenience and save
energy.
• Eg: Turning your oven on when you leave work instead
of waiting to get home.
• A thermostat that knows when you’re home and adjusts
the temperature accordingly can help you save money
by not heating the house when you’re out.

2/10/2021 10:19 PM M.Tech-CSE-BIT 20


Foundations of AI

2/10/2021 10:19 PM M.Tech-CSE-BIT 21


Application areas of AI

2/10/2021 10:19 PM M.Tech-CSE-BIT 22


Introduction
• The foundation of Artificial Intelligence (AI) was
laid with the development of Boolean theory and
principles by a mathematician named Boole and
others researchers.
• AI currently comprises of a huge variety of
subfields ranging from general-purpose areas such
as perception, logical reasoning, to specific tasks
such as game playing, theorem proving, diagnosing
diseases, etc.
• Scientists of other fields use tools of artificial
intelligence to systematize and automate the
intellectual tasks of their fields.

2/10/2021 10:19 PM M.Tech-CSE-BIT 23


Intelligent Systems
• ELIZA: Is the world’s first Chatbot created at MIT by Joseph
Weizenbaum. Eliza was a program that conversed with user in
English. The program was able to converse about any subject,
because it stored subject information in data banks.
• ELIZA could not talk like Alexa. She conveyed through content.
• Categorization of Intelligent Systems:
• In order to design Intelligent system, it is important to categorize
these systems.
• There are four possible categories of such systems, i.e.
– System that thinks like humans
– System that acts like humans
– System that thinks rationally
– System that acts rationally
2/10/2021 10:19 PM M.Tech-CSE-BIT 24
Intelligent Systems
• AI techniques must be independent of the problem domain .
• Three Components of AI Program
 Knowledge base
 Control strategy
 Inference mechanism
 Knowledge base generally consists of facts and rules.
 Control Strategy determines which rule to be applied.
 Inference Mechanism requires search through knowledge base
and derives new knowledge using the existing knowledge with
the help of inference rules.

2/10/2021 10:19 PM M.Tech-CSE-BIT 25


Foundations of AI
• AI is interdisciplinary in nature.
• Foundations of AI are in various fields such as:
– Mathematics
– Neuroscience(Studying the functioning of brain)
– Control theory(Machines can modify their behavior
in response to the environment)
– Linguistics(Analysis of human languages)

2/10/2021 10:19 PM M.Tech-CSE-BIT 26


Sub-areas of AI
• Knowledge representation models.
• Theorem proving mechanisms.
• Game playing methodologies.
• Common sense reasoning dealing with uncertainty
and decision making.
• Learning models, inference techniques, pattern
recognition, search and matching, etc.
• Logic (fuzzy, temporal, modal)
• Planning and scheduling.
• Models for intelligent tutoring systems.
• Robotics.
• Data mining.
2/10/2021 10:19 PM M.Tech-CSE-BIT 27
Applications
• AI finds applications in almost all areas of real-
life applications.
• Business: financial strategies, give advice
• Engineering: check design, offer suggestions to
create new product, expert systems for all
engineering applications
• Manufacturing: assembly, inspection, and
maintenance
• Medicine: monitoring, diagnosing, and
prescribing
• Education: in teaching
2/10/2021 10:19 PM M.Tech-CSE-BIT 28
Development of AI Languages
• AI languages have traditionally been those
which stress on knowledge representation
schemes; pattern matching, flexible search, and
programs as data.
• The typical examples of such languages are
LISP, Pop-2, ML, and Prolog.
• AI programming can exploit any language from
BASIC through C to Smalltalk.

2/10/2021 10:19 PM M.Tech-CSE-BIT 29


Problem Solving: State- Space Search and
Control Strategies(Ch-2)
Introduction
• Problem solving is a method of deriving solution
steps beginning from initial description of the
problem to the desired solution.
• It is one of the focus areas of Artificial Intelligence
(AI) and can be characterized as a systematic search
using a range of possible steps to achieve some
predefined solution.
• The task is solved by a series of actions that
minimizes the difference between the given situation
and the desired goal.
2/10/2021 10:19 PM M.Tech-CSE-BIT 30
General Problem Solving
• Discuss the methods that facilitate the modeling of problems and
search processes:
– Production System: It is one of the method that helps AI
programs to do search process more conveniently in state-
space problems.
– State-Space: A state space basically consists of four
components:
• A set S containing start states of the problem
• A set G containing goal states of the problem
• Set of nodes (states) in the graph/tree.
• Set of arcs connecting nodes.
– Control Strategies: Control strategy is one of the most
important components of problem solving that describes the
order of application of the rules to the current state.
2/10/2021 10:19 PM M.Tech-CSE-BIT 31
DEFINING PROBLEM AS A STATE SPACE
SEARCH
• To solve the problem of playing a game, we require the rules of
the game and targets for winning as well as representing
positions in the game.
• The opening position can be defined as the initial state and a
winning position as a goal state.
• Moves from initial state to other states leading to the goal state
follow legally.
• The rules are far too abundant in most games— especially in
chess, where they exceed the number of particles in the universe.
• Thus, the rules cannot be supplied accurately and computer
programs cannot handle easily.
• The storage also presents another problem but searching can be
achieved by hashing.
2/10/2021 10:19 PM M.Tech-CSE-BIT 32
DEFINING PROBLEM AS A STATE SPACE
SEARCH
• The number of rules that are used must be minimized and the set
can be created by expressing each rule.
• The representation of games leads to a state space representation
and it is common for well-organized games with some structure.
• This representation allows for the formal definition of a problem
that needs the movement from a set of initial positions to one of
a set of target positions.
• It means that the solution involves using known techniques and a
systematic search, which is quite a common method in Artificial
Intelligence.

2/10/2021 10:19 PM M.Tech-CSE-BIT 33


PRODUCTION SYSTEMS
• Production systems(PS) provide appropriate structures for
performing and describing search processes.
• A PS has number of production rules in which each Production
rule
1. Has a left side that determines the applicability of the rule and a
right side that describes the operation to be performed if the rule
is applied. Left side of the rule is the current state, Right side
describes the new state that is obtained by applying the rule.
2. The production rules operate on the DB that change as these
rules are applied.
3. A control strategy that specifies the order in which the rules will
be compared with facts in the database and also specifies how to
resolve conflicts when several rules match at once.
2/10/2021 10:19 PM M.Tech-CSE-BIT 34
PRODUCTION SYSTEMS
• The production rules operate on the knowledge
database.
• Each rule has a precondition—that is, either satisfied
or not by the knowledge database.
• If the precondition is satisfied, the rule can be applied.
• Application of the rule changes the knowledge
database.
• The control system chooses which applicable rule
should be applied and ceases computation when a
termination condition on the knowledge database is
satisfied.
2/10/2021 10:19 PM M.Tech-CSE-BIT 35
The Water Jug Problem
• In this problem, we use two jugs called four and three; four
holds a maximum of four gallons of water and three a
maximum of three gallons of water.
• How can we get two gallons of water in the four jug?
• The state space is a set of prearranged pairs giving the number
of gallons of water in the pair of jugs at any time, i.e., (four,
three) where four = 0, 1, 2, 3 or 4 and three = 0, 1, 2 or 3.
• The start state is (0, 0) and the goal state is (2, n) where n may
be any but it is limited to three holding from 0 to 3 gallons of
water or empty.
• Three and four shows the name and numerical number shows
the amount of water in jugs for solving the water jug problem.

2/10/2021 10:19 PM M.Tech-CSE-BIT 36


The major production rules for solving this problem are shown below:

• Initial condition Goal comment

1. (four, three) if four < 4 (4, three) fill four from tap
2. (four, three) if three< 3 (four, 3) fill three from tap
3. (four, three) If four > 0 (0, three) empty four into drain
4. (four, three) if three > 0 (four, 0) empty three into drain
5. (four, three) if four + three (four + three, 0) empty three into four
6. (four, three) if four + three <3 (0,four+Three) Empty four into Three
7. (0, three) If three > 0 (three, 0) empty three into four
8. (four, 0) if four > 0 (0, four) empty four into three
9. (0, 2) (2, 0) empty three into four
10. (2, 0) (0, 2) empty four into three
11. (four, three) if four < 4 (4, three-diff) pour diff, 4-four, into four
from three
12. (three, four) if three < 3 (four-diff, 3) pour diff, 3-three, into three from
four and a solution is given below four three rule
2/10/2021 10:19 PM M.Tech-CSE-BIT 37
Production Rules for the Water Jug Problem
Gallons in Four Jug Gallons in Three Jug Rules Applied

0 0 -
0 3 2
3 0 7
3 3 2
4 2 11
0 2 3
2 0 10
• The problem solved by using the production rules in combination with an
appropriate control strategy, moving through the problem space until a path
from an initial state to a goal state is found.
• In this problem solving process, search is the fundamental concept.
• For simple problems it is easier to achieve this goal by hand but there will be
cases where this is far too difficult.
2/10/2021 10:19 PM M.Tech-CSE-BIT 38
Production Rules for the Water Jug Problem
Solution: State space for this problem is set of ordered pairs of
Integers (X,Y) such that X represents the number of gallons of
water in 5-g Jug and Y for 3-g jug.
1. Start State is (0,0)
2. Goal state is (4,N) for any value of N <=3
 The possible operations that can be used are
1. Fill 5-g jug from the tap & empty by throwing water down the
drain.
2. Fill 3-g jug from the tap & empty by throwing water down the
drain.
3. Pour some or 3-g water from 5-g jug into the 3-g jug to make it
full.
4. Pour some or full 3-g jug water into the 5-g jug.
2/10/2021 10:19 PM M.Tech-CSE-BIT 39
Production system

2/10/2021 10:19 PM M.Tech-CSE-BIT 40


Solution Path-1

2/10/2021 10:19 PM M.Tech-CSE-BIT 41


Solution -2

2/10/2021 10:19 PM M.Tech-CSE-BIT 42


Problem 2: Missionaries and Cannibals
R

boat River
boat
L

Missionaries Cannibals
Missionaries Cannibals
Constraints
 The boat can carry at most 2 people

 On no bank should the cannibals outnumber the missionaries


Example - Missionaries & Cannibals
http://www.novelgames.com/en/spgame
s/missionaries/
Missionaries & Cannibals
• Missionaries and Cannibals is a problem in which 3 missionaries
and 3 cannibals want to cross from the left bank of a river to the
right bank of the river.
• There is a boat on the left bank, but it only carries at most two
people at a time (and can never cross with zero people). If
cannibals ever outnumber missionaries on either bank, the
cannibals will eat the missionaries.
• A state can be represented by a triple, (nM mC B), where n is the
number of missionaries on the left, m is the number of cannibals
on the left, and B indicates whether the boat is on the left bank or
right bank.

2/10/2021 10:19 PM M.Tech-CSE-BIT 45


Missionaries & Cannibals
• For example:
The initial state is (3 3 L) and the goal state is (0 0 R).
Operators are:
• MM: 2 missionaries cross the river
• CC: 2 cannibals cross the river
• MC: 1 missionary and 1 cannibal cross the river
• M: 1 missionary crosses the river
• C: 1 cannibal crosses the river at

2/10/2021 10:19 PM M.Tech-CSE-BIT 46


Missionaries & Cannibals

2/10/2021 10:19 PM M.Tech-CSE-BIT 47


Missionaries & Cannibals(one possible solution)

2/10/2021 10:19 PM M.Tech-CSE-BIT 48


Solution Path

2/10/2021 10:19 PM M.Tech-CSE-BIT 49


Example - Missionaries & Cannibals

• State space – [M,C,B]


• Initial State – [3,3,1]
• Goal State – [0,0,0]
• Operators – adding or subtracting the vectors
[1,0,1], [2,0,1], [0,1,1], [0,2,1] or [1,1,1]
• Path – moves from [3,3,1] to [0,0,0]
• Path Cost – river trips
• http://www.plastelina.net/game2.html
• http://www.youtube.com/watch?v=W9NEWxabGmg

2/10/2021 10:19 PM M.Tech-CSE-BIT 50


State space search
• Another method of problem representation that facilitates easy
search.
• While solving a problem, we can find a path from start state to
Goal state.
• State space consists of 4 components
1. A set S containing start states of the problem.
2. A set G containing goal states of the problem.
3. set of nodes(states) in the graph/tree. Each node represents
the state in the problem solving process.
4. Set of arcs connecting the nodes. Each arc corresponds to
operator that is a step in problem solving process.
 A Solution path is a path through the graph from a node in S
to a node in G.
2/10/2021 10:19 PM M.Tech-CSE-BIT 51
State space search
 The main objective is to determine a solution path in the
graph.
 As there may be more than one way of solving the problem,
there may be more than one solution paths(Based on some
criteria of goodness).
 In this approach we use operators instead of production rules.
 Possible operators that are applied in this problem are {2M0C,
1M1C,0M2C, 1M0C, 0M1C}
 M is Missionaries and C is cannibals. Digits before the
characters indicates the number of M & C at any point of time.
 The operator is , if the boat is on the left Bank.
 The operator is , if the boat is on the right Bank.

2/10/2021 10:19 PM M.Tech-CSE-BIT 52


State space search
 Let us represent the state(L:R), where L=n1Mm1C1B
and R=n2Mm2C0B , B represents boat with 1 or 0 indicating
presence or absence of boat.
1. Start state: (3M3C1B:0M0C0B) or (331:000)
2. Goal state: (0M0C0B:3M3C1B) or (000:331)
 Invalid states will be filtered. Illegal operators are not
applicable to some states.

2/10/2021 10:19 PM M.Tech-CSE-BIT 53


State space search
 To illustrate the progress of the search, develop a tree of nodes.
 Each node in the tree represents state. Root node is used to
represent the start state.
 Arcs of the tree indicate the application of one of the operators.
 Nodes for which no operators are applied, are called leaf nodes.
 Search space generated using valid operators and the sequence
of operators applied are shown below.

2/10/2021 10:19 PM M.Tech-CSE-BIT 54


Search Space

2/10/2021 10:19 PM M.Tech-CSE-BIT 55


Two Solution paths

2/10/2021 10:19 PM M.Tech-CSE-BIT 56


Eight puzzle problem
Problem statement:
• Eight puzzle problem invented and popularized by Noyes
Palmer Chapman in the 1870s, has a 3X3 grid with 8 randomly
numbered( 1 to 8) tiles arranged on it with one empty cell. At
any point, the adjacent tile can move to empty cell creating a
new empty cell.
• Solving this problem involves arranging tiles in such a way that
we get goal state from start state.

2/10/2021 10:19 PM M.Tech-CSE-BIT 57


Eight puzzle problem
 The start and goal states is represented as follows with each list
representing corresponding row.
1. Start state:[[3,7,6],[5,1,2],[4,0,8]]
2. Goal state:[[5,3,6],[7,0,2],[4,1,8]]
3. The operators can be thought of moving{Up,Down,Left,Right},
the direction in which blank square effectively moves.

2/10/2021 10:19 PM M.Tech-CSE-BIT 58


Search tree for Eight Puzzle problem

2/10/2021 10:19 PM M.Tech-CSE-BIT 59


Control Strategies
 Control Strategy is a technique , tells us about which rule has to
be applied next while searching for the solution of a problem
within problem space. It helps us to decide which rule has to
apply next without getting stuck at any point.
 Most important components of problem solving that describes
the order of application of the rules to the current state.
 To solve the some real world problems, effective control strategy
must be used.
 Problem can be solved by searching for a solution and the
search strategy is to find the correct search strategy for a given
problem.
 There are two directions
1. Data-driven search, called forward Chaining, from start state.
2. Goal-driven search, called backward Chaining, from goal state.
2/10/2021 10:19 PM M.Tech-CSE-BIT 60
Control Strategies
1. Data-driven search(forward Chaining).
 Begins with known facts and works towards a conclusion.
Eg: 8 Puzzle problem(Start from start state and work forward
goal state). We Build a tree of move sequences with root of
tree as start state. Next level states are generated by
finding all rules whose left sides match with root and use
their right side to create the new state.
 This process is continued until a configuration that
matches the goal state is generated.
2. Goal-driven search(Backward Chaining):
 Begins with goal state and continues working backwords,
generating more sub-goals until we reach a start state.
 Depending on the nature of the problem, we can use both
strategies for problem solving.
2/10/2021 10:19 PM M.Tech-CSE-BIT 61

You might also like