Cs344 Lect1to6 Introduction and Fuzzy Logic Jan7to21 2013
Cs344 Lect1to6 Introduction and Fuzzy Logic Jan7to21 2013
Intelligence
(associated lab: CS386)
Pushpak Bhattacharyya
CSE Dept.,
IIT Bombay
Lecture–1 to 6: Introduction; Fuzzy sets
and logic; inverted pendulum
7th, 8th, 9th 14th, 15th , 21st Jan, 2013
Basic Facts
Faculty instructor: Dr. Pushpak Bhattacharyya
(www.cse.iitb.ac.in/~pb)
TAship: Kashyap, Bibek, Samiulla, Lahari, Jayaprakash, Nikhil,
Kritika and Shuvam
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected]
Course home page
www.cse.iitb.ac.in/~cs344-2013 (will be up soon)
Robotics
NLP
Search,
Expert Reasoning, IR
Systems Learning
Planning
Computer
Vision
From Wikipedia
Artificial intelligence (AI) is the intelligence of machines and the branch of
computer science that aims to create it. Textbooks define the field as "the study
and design of intelligent agents"[1] where an intelligent agent is a system that
perceives its environment and takes actions that maximize its chances of
success.[2] John McCarthy, who coined the term in 1956,[3] defines it as "the
science and engineering of making intelligent machines."[4]
The field was founded on the claim that a central property of humans, intelligence—
the sapience of Homo sapiens—can be so precisely described that it can be
simulated by a machine.[5] This raises philosophical issues about the nature of
the mind and limits of scientific hubris, issues which have been addressed by
myth, fiction and philosophy since antiquity.[6] Artificial intelligence has been the
subject of optimism,[7] but has also suffered setbacks[8] and, today, has become
an essential part of the technology industry, providing the heavy lifting for many
of the most difficult problems in computer science.[9]
AI research is highly technical and specialized, deeply divided into subfields that
often fail to communicate with each other.[10] Subfields have grown up around
particular institutions, the work of individual researchers, the solution of specific
problems, longstanding differences of opinion about how AI should be done and
the application of widely differing tools. The central problems of AI include such
traits as reasoning, knowledge, planning, learning, communication, perception
and the ability to move and manipulate objects.[11] General intelligence (or
"strong AI") is still a long-term goal of (some) research.[12]
Topics to be covered (1/2)
Search
General Graph Search, A*, Admissibility, Monotonicity
Iterative Deepening, α-β pruning, Application in game playing
Logic
Formal System, axioms, inference rules, completeness, soundness and
consistency
Propositional Calculus, Predicate Calculus, Fuzzy Logic, Description
Logic, Web Ontology Language
Knowledge Representation
Semantic Net, Frame, Script, Conceptual Dependency
Machine Learning
Decision Trees, Neural Networks, Support Vector Machines, Self
Organization or Unsupervised Learning
Topics to be covered (2/2)
Evolutionary Computation
Genetic Algorithm, Swarm Intelligence
Probabilistic Methods
Hidden Markov Model, Maximum Entropy Markov Model,
Conditional Random Field
IR and AI
Modeling User Intention, Ranking of Documents, Query Expansion,
Personalization, User Click Study
Planning
Deterministic Planning, Stochastic Methods
Man and Machine
Natural Language Processing, Computer Vision, Expert Systems
Philosophical Issues
Is AI possible, Cognition, AI and Rationality, Computability and AI,
Creativity
Foundational Points
Church Turing Hypothesis
Anything that is computable is computable
by a Turing Machine
Conversely, the set of functions computed
by a Turing Machine is the set of ALL and
ONLY computable functions
Turing Machine
Finite State Head (CPU)
Limits to computability
Halting problem: It is impossible to
construct a Universal Turing Machine that
given any given pair <M, I> of Turing
Machine M and input I, will decide if M
halts on I
What this has to do with intelligent
computation? Think!
Foundational Points (contd)
Limits to Automation
Godel Theorem: A “sufficiently powerful”
formal system cannot be BOTH complete
and consistent
“Sufficiently powerful”: at least as powerful
as to be able to capture Peano’s Arithmetic
Sets limits to automation of reasoning
Foundational Points (contd)
Fuzzy Logic
Fuzzy Logic tries to capture the
human ability of reasoning with
imprecise information
Modal Logic
New operators beyond AND, OR, IMPLIES,
Quantification etc.
Naïve Physics
Abduction Example
If
there is rain (P)
Then
there will be no picnic (Q)
Abductive reasoning:
Observation: There was no picnic(Q)
Conclude : There was rain(P); in absence
of any other evidence
Alternatives to fuzzy logic model
human reasoning (2/2)
Numerical
Fuzzy Logic
Probability Theory
Bayesian Decision Theory
Possibility Theory
Uncertainty Factor based on
µrich(w) µpoor(w)
wealth w wealth w
Example Profiles
µA (x) µA (x)
x x
‘very’ operation:
µtall(h) very tall
µvery tall(x) = µ2tall(x)
‘somewhat’ operation:
.
θ d / dt = angular velocity
Motor i=current
The goal: To keep the pendulum in vertical position (θ=0)
in dynamic equilibrium. Whenever the pendulum departs
from vertical, a torque is produced by sending a current ‘i’
.θ
-ve -ve +ve +ve
med Zero
θ small small med
-ve
med
+ve
med
Each cell is a rule of the form
.
If θ is <> and θ is <>
then i is <>
4 “Centre rules”
.
1. if θ = = Zero and θ = = Zero then i = Zero
.
2. if θ is +ve small and θ = = Zero then i is –ve small
.
3. if θ is –ve small and θ = = Zero then i is +ve small
.
4. if θ = = Zero and θ is +ve small then i is –ve small
.
5. if θ = = Zero and θ is –ve small then i is +ve small
Linguistic variables
1. Zero
2. +ve small
3. -ve small
Profiles
zero
1
-ve small +ve small
-ε3 -ε2 ε2 ε3
-ε +ε .
Quantity (θ, θ , i)
Inference procedure
.
1. Read actual numerical values of θ and θ
2. Get the corresponding µ values µZero, µ(+ve small),
µ(-ve small). This is called FUZZIFICATION
3. For different rules, get the fuzzy I-values from
the R.H.S of the rules.
4. “Collate” by some method and get ONE current
value. This is called DEFUZZIFICATION
5. Result is one numerical value of ‘i’.
Rules Involved
zero
1
-ve small +ve small
-ε3 -ε2 ε2 ε3
-ε +ε .
Quantity (θ, θ , i)
Fuzzification
zero
1
-ve small +ve small
1 rad/sec
-ε3 -ε2 ε2 ε3
-ε +ε .
1rad Quantity (θ, θ , i)
Fuzzification
Suppose θ is 1 radian and dθ/dt is 1 rad/sec
µzero(θ =1)=0.8 (say)
µ +ve-small(θ =1)=0.4 (say)
µzero(dθ/dt =1)=0.3 (say)
µ+ve-small(dθ/dt =1)=0.7 (say)
0.4
Required i value
Centroid of three
trapezoids
-ve medium
-ve small
zero
-4.1
-2.5 -ε +ε
Possible candidates:
i is the x-coord of the centroid of the areas given by the
blue trapezium, the green trapeziums and the black trapezium
Fuzzy Sets
Theory of Fuzzy Sets
(0,0) (1,0)
Φ x1 x1
E ( S ) d ( S , nearest ) / d ( S , farthest )
x2
A (0.5,0.5)
d(A, nearest)
(0,0) (1,0)
x1
d(A, farthest)
Definition
Distance between two fuzzy sets
n
d ( S1 , S 2 ) | s1 ( xi ) s2 ( xi ) |
i 1
L1 - norm
s c ( x) 1 s ( x)
Example of Operations on
Fuzzy Set
Let us define the following:
Universe U={X1 ,X2 ,X3}
Fuzzy sets
A={0.2/X1 , 0.7/X2 , 0.6/X3} and
B={0.7/X1 ,0.3/X2 ,0.5/X3}
Then Cardinality of A and B are computed as follows:
Cardinality of A=|A|=0.2+0.7+0.6=1.5
Cardinality of B=|B|=0.7+0.3+0.5=1.5
(0,1) (1,1)
A
x2 . B1 Region where B ( x) A ( x)
.B2
.B3
(0,0) (1,0)
x1
This effectively means
B P( A) CRISPLY
P(A) = Power set of A
Eg: Suppose
A = {0,1,0,1,0,1,…………….,0,1} – 104 elements
B = {0,0,0,1,0,1,……………….,0,1} – 104 elements
Isn’t B A with a degree? (only differs in the 2nd element)
Subset operator is the “odd
man” out
AUB, A∩B, Ac are all “Set Constructors” while
A B is a Boolean Expression or predicate.
According to classical logic
In Crisp Set theory A B is defined as
x xA xB
So, in fuzzy set theory A B can be defined as
x µA(x) µB(x)
Zadeh’s definition of subsethood goes
against the grain of fuzziness theory
Another way of defining A B is as follows:
x µA(x) µB(x)
Thus, these two definitions violate the fuzzy principle that every
belongingness except Universe is fuzzy
Fuzzy definition of subset
Measured in terms of “fit violation”, i.e. violating the
condition B ( x) A ( x)
Degree of subset hood S(A,B)= 1- degree of superset
max(0,
x
B ( x) A ( x))
= 1
m( B )
m(B) = cardinality of B
= B ( x)
x
We can show that E ( A) S ( A Ac , A Ac )
Exercise 1:
Show the relationship between entropy and subset hood
Exercise 2:
Prove that
S ( B, A) m( A B) / m( B)
Subset hood of B in A
Fuzzy sets to fuzzy logic
Forms the foundation of fuzzy rule based system or fuzzy expert system
Expert System
Rules are of the form
If
C1 C2 ...........Cn
then
Ai
Where Cis are conditions
Eg: C1=Colour of the eye yellow
C2= has fever
C3=high bilurubin
A = hepatitis
In fuzzy logic we have fuzzy predicates
Classical logic
P(x1,x2,x3…..xn) = 0/1
Fuzzy Logic
P(x1,x2,x3…..xn) = [0,1]
Fuzzy OR
P( x) Q( y ) max(P( x), Q( y ))
Fuzzy AND
P ( x) Q( y ) min( P ( x), Q( y ))
Fuzzy NOT
~ P( x) 1 P( x)
Fuzzy Implication
Many theories have been advanced and many
expressions exist
The most used is Lukasiewitz formula
t(P) = truth value of a proposition/predicate. In
fuzzy logic t(P) = [0,1]
t(P Q ) = min[1,1 -t(P)+t(Q)]
What is t(q)
t ( B ( xi ) A ( xi )) min(1,1 t ( B ( xi )) t ( A ( xi )))
1 U 2 U
A B
B A
3 U 4 U
A A
B B
Proof (contd…)
Case I:
A(xi ) 1 only when B(xi ) 1 So, B (xi ) A(xi ) 0
So,
max(0,
xi U
B ( xi ) A ( xi ))
Sub( B, A) 1
xi U
B ( xi )
0
1 1
B ( xi )
xi U
Proof (contd…)
Since B ( xi ) A ( xi ) 0
L t ( B ( xi ) A ( xi )) min(1,1 (t ( B ( xi )) t ( A ( xi ))))
min(1,1 (ve)) 1
max(0,
xi U
B ( xi ) A ( xi ))
Sub( B, A) 1
xi U
B ( xi )
Proof (contd…)
B ( xi ) A ( xi ) 0
A ( xi )
Sub( B, A) 1 1 ,
B ( xi )
0 Sub( B, A) 1
Thus, in case II also, these two equations are
consistent with each other.
Proof of case III
Case III: In This case, B(xi ) A(xi ) 0 for xi (B A)
and B (xi ) A(xi ) 0 otherwise
So,
max(0,
xi U
B ( xi ) A ( xi ))
Sub( B, A) 1
xi U
B ( xi )
Proof (contd…)
B ( xi ) A ( xi ) 0 only for xi ( B A)
| B A| | A B |
S ( B, A) 1
|B| |B|
So,
max(0,
xi U
B ( xi ) A ( xi ))
Sub( B, A) 1
xi U
B ( xi )
Proof (contd…)
B ( xi ) A ( xi ) 1 only for xi B
and <=0 otherwise,
|B|
S ( B, A) 1 0
|B|
Thus, in case IV also, these two equations are
consistent with each other.
Hence we can say that these two equations are
consistent with each other in general.