Ai 3
Ai 3
INTELLIGENCE
Overview of Artificial
Intelligence: MODULE I
Artificial intelligence (AI) refers to the
simulation of human intelligence in
machines that are programmed to think like
humans and mimic their actions
John McCarthy (1955-1956)
AI action
Controller/ sensors
Processor:
Knowledge/
Model Environment
AI AGENT
Actuators
How to develop knowledge??
https
://www.kaggle.com/jessicali9530/stanford-dog
s
What is AI ?
Game Playing
Speech Recognition
Understanding Natural Language
Computer Vision
Expert Systems
Heuristic Classification
Game Playing
Speech Recognition
Speech Recognition
Perception
Learning
Knowledge Representation and Reasoning
Planning
Execution
Knowledge Based Systems
Knowledge base
Contains system organized collection of facts
about a system domain.
Inference Engine
Tries to derives answers from knowledge base
User Interface
Enables the user to communicate with KBS.
Knowledge Representation
Rohit 65 33
Dhoni 70 39
kohli 50 32
Inheritable Knowledge
Logical Representation
Semantic Network Representation
Frame Representation
Production Rules
Logical Representation
Protyping: Expert+KE
Semantics
Defines the truth or meaning of sentence in a
world
PL is a simple logic
AND ∧ A∧B
OR ∨ A ∨B
IMPLIES → A →B
IF AND ONLY ↔ A ↔B
IF
Negation(¬)
P ¬p
T F
F T
Conjunction(AND)
p q p∧q
T T T
T F F
F T F
F F F
Disjunction(OR)
p q p∨q
T T T
T F T
F T T
F F F
Implication(Then)
p q p→q
T T T
T F F
F T T
F F T
If and only If
p q p↔q
T T T
T F F
F T F
F F T
1) A-> It is not hot
B-> It is humid
C-> It is raining
Condition
A)If it is humid then it is hot
B→C
B)If it is hot and humid then it is not raining
A∧B→¬C
2) Translate the following propositional logic
into english sentences.
E-> Lion is eating
H->Lion is hungry
a)E→ ¬H
b)E∧ ¬H
c)¬(H → ¬E)
3)Translate the following English sentences to
Propositional Logic.
R-> Raining
S-> Rohit is Sick
H-> Rohit is Hungry
HA->Rohit is happy
C-> Rohit have a Cat
D-> Rohit have a Dog
1) It is raining if and only if rohit is sick
2) If rohit is sick then it is raining and
viceversa
3) Rohit is hungry but happy
4) Rohit either have a cat or a dog
Convert to PL
p ¬p pv¬p
T F T
F T T
Contradiction
Compound proposition which is always false.
p ¬p p∧¬p
T F F
F T F
Contigency
Contigency
Compound proposition which is sometimes
true and sometimes false.
p q p∧q
T T T
T F F
F T F
F F F
Contigency
Satisfiability
Compound proposition is satisfiable if there
is atleast one true result in its truth table.
p q p∧q
T T T
T F F
F T F
F F F
Unsatisfiablity
Not even a single true result in its truth table.
p ¬p p∧¬p
T F F
F T F
Valid
A Compound statement is when it is tautology
p ¬p pv¬p
T F T
F T T
Invalid
A compound statement is invalid when it is
either contradiction or contigency.
Logical equivalences
T T T
F T F
Most common Logical equivalences
Which of the following boolean expression is
not a tautology?
a)(a→b) ∧(b→c) →(a→c)
b)(a↔c) →(¬b →(a ∧c))
c)(a ∧b ∧c) →(cv a)
d)a →(b →a)
The following propositional logic is
(p →(q ∨ r)) →((p ∧q) →r)
p p p→q
p→q p→q q → ¬r
q → ¬r q ¬r
¬r q →¬r
¬r
Limitation of PL
Predicates
Quantifiers
Types of Quantifiers
Universal quantifier
Existential quantifier
Let p(x) be a statement x+1>x
p(1)= 1+1>1 T
P(2)=2+1>2 T
∀x p(x)
Let q(x) be the statement x<2
q(1):1<2 True
q(2):2<2 False
∃x q(x)
Universal quantiifer
∃x p(x)
What is the truth value of ∃x p(x), where
p(x) is the statement x>10 and the domain
consists of the postive integers not
exceeding 4?
Logical equivalences involving predicates and
quantifiers
∀x(p(x))
There is some student in the Kerala
university who has not studied AI
∃x ¬ p(x)
Nested quantifier
∀x ∃y Q(x,y)
∀x ∃y Q(x,y)= ∀x P(x)
∀x ∀y Q(x,y)
∀x ∃y Q(x,y)
∃y ∀x Q(x,y)
∃x ∃y Q(x,y)
Q)The sum of two postive integers is always
positive.
2 3 4 1 2 3
5 1 8 1
8 7 6 7 6 5
2 4 2 3 4 2 3 4
5 3 1 5 7 1 5 1
8 7 6 8 6 8 7 6
Examples of search problems
4 3
Types of Search Algorithm
Disadvantages:
It does not care about the number of steps
involve in searching and only concerned
about path cost. Due to which this algorithm
may be stuck in an infinite loop.
Depth-Limited Search Algorithm:
A depth-limited search algorithm is similar to
depth-first search with a predetermined limit.
Disadvantages:
• Incompleteness.
• It may not be optimal if the problem has more
than one solution.
Iterative deepening depth-first Search:
• The iterative deepening algorithm is a
combination of DFS and BFS algorithms.
Disadvantages:
The main drawback of IDDFS is that it
repeats all the work of the previous phase.
1'st Iteration-----> A
2'nd Iteration----> A, B, C
3'rd Iteration------>A, B, D, E, C, F, G
Bidirectional Search Algorithm
• Two different search algorithm runs
simultaneously
Disadvantages
• Implementation of the bidirectional search
tree is difficult.
• In bidirectional search, one should know the
goal state in advance.
Informed Search
Informed search algorithm contains an array
of knowledge such as how far we are from the
goal, path cost, how to reach to goal node.
A-C-F-G =14+10+20=44
A* Search Algorithm
• A* search is the most commonly known form
of best-first search.
S->A->B=1+2+3=7
S->A->C=1+1+2=4
S->A->C->G=1+1+4=6
S->A->C->D=1+1+3+6=11
And-Or graphs(AO*)Search
• AO* is also known as AND-OR graph search
algorithms.
• According to AO* algorithm it is not exploring
all the solution paths once it has got the
solution.
• AO* Algorithm basically based on problem
decompositon (Breakdown problem into small
pieces)
When a problem can be divided into a set of
sub problems, where each sub problem can
be solved separately and a combination of
these will be a solution.
A* Vs AO*
• Both are part of informed search technique
and use heuristic values to solve the problem.
• A* always gives an optimal solution (shortest
path with low cost) But it is not guaranteed to
that in AO*. Because AO* does not explore all
the solution path once it got solution.
mobile
And
arc
Word Purchase
Gift hard mobile
OR
AND
ARTIFICIAL
INTELLIGENCE
NLP:
: MODULE IV
NLP
1)Question Answering
Question Answering focuses on building
systems that automatically answer the
questions asked by humans in a natural
language.
Spam Detection
Spam detection is used to detect unwanted e-
mails getting to a user's inbox.
Machine Translation
Machine translation is used to translate text
or speech from one natural language to
another natural language.
Spelling correction
Speech Recognition
Speech recognition is used for converting
spoken words into text. It is used in
applications, such as mobile, home
automation, video recovery, voice biometrics,
voice user interface, and so on.
Chatbot
Implementing the Chatbot is one of the
important applications of NLP. It is used by
many companies to provide the customer's
chat services.
Grammars and Languages
Sentence→NounPhrase VerbPhrase
When a parse tree is built from the top down,
it is known as a derivation tree.
Basic Parsing Techniques
Transition Networks
Augmented Transition Networks
Semantic Analysis
Transition Networks
A transition network is a finite state
automaton that is used to represent a part of
a grammar.
Augmented Transition Networks
An augmented transition network, or ATN, is an
extended version of a transition network.
Variables
The structures are constructed from basic
atomic elements, numbers and characters.
Euclidean Distance:
• Euclidean distance is considered the
traditional metric for problems with
geometry.
• It can be simply explained as the ordinary
distance between two points.
Manhattan Distance(city block distance):
• This determines the absolute difference
among the pair of the coordinates.
Each node stores details of which facts have
been matched by the rules at that point in the
path.