Unit 4 Knowledge Representation and Reasoning
Unit 4 Knowledge Representation and Reasoning
Knowledge is important in problem solving by computer because to solve a problem by a computer, it first
must be represented in computer understandable form.
The process of converting informal knowledge into computer understandable form is known as
knowledge representation scheme. A representation scheme specifies the form of the knowledge. A
knowledge base is the representation of all of the knowledge that is stored by an agent.
Relationships
What about the relationship between the attributes of an object, such as, inverses, existence, techniques for reasoning
about values and single valued attributes.
Knowledge representation system is a formalized structure and set of operations that embodies the descriptions, relationships,
and procedures provided in a in an artificial intelligence system. The process Considers how to represent the knowledge in the
system such that it can be used to solve problems.
2. Inferential Adequacy:-
The ability to present all of the kinds of inferential procedures.
3. Acquisitional Efficiency:-
The ability to acquire new knowledge using automatic methods wherever possible rather than
reliance on human intervention.
Types of Knowledge Representations Systems:
1. Semantic Nets
2. Frame based knowledge representations
3. Conceptual Dependencies
4. Script structure
5. Rule Based( production system) Knowledge Representations System
6. Propositional Logic ( sentential logic and statement logic)
7. Predicate Logic (First Order Logic or Quantified logic)
Semantic Nets
It is a kind of directed graph where node may represent a fact description such as
. Physical object
. Concept
. Event
And an arc (or link) represents relationships between nodes. There are some
‘standard’ relationship types
Structure:
•Nodes: These represent concepts, entities, or objects in the world. Examples could be "cat," "bird," "Tom"
(a specific cat), or "Whiskers" (another specific cat).
•Links: These labeled arrows connect the nodes and represent the relationships between the concepts.
Common link types include:
Advantages:
•Visually intuitive: Semantic nets are easy to understand due to their graphical nature. People can easily
grasp the connections between concepts.
•Natural representation: They mimic how humans categorize and link concepts in their minds.
•Efficient reasoning: The connections between concepts allow for inferencing new knowledge. For
instance, if "cat is-a mammal" and "mammal is-a warm-blooded animal," we can infer that
•"cat is-a warm-blooded animal."
•Inheritance: Knowledge about a general class (e.g., mammal) can be inherited by specific subclasses
(e.g., cat), reducing redundancy.
Disadvantages:
•Ambiguity: The meaning of links can be unclear, especially with a single "is-a" link. It might represent an instance-
of relationship (Tom is-a cat) or a subclass-of relationship (cat is-a mammal).
•Limited expressiveness: Compared to logic-based approaches, semantic nets struggle to represent complex
relationships or quantification (e.g., all cats are mammals).
•Scalability challenges: Large knowledge bases can become unwieldy and difficult to maintain with simple
semantic nets.
Overall, semantic nets are a valuable tool for representing knowledge in some AI applications,
Components of a semantic Network
Lexical part:
i. nodes – denoting object
ii. Links – denoting relations between objects
iii. Abels – denoting particular objects and relations
Structural part:
. The links and nodes from directed graphs the labels are placed on the links and nodes.
Semantic part:
. Meanings are associated with the link and node labels.
Procedural part:
.Constructors allow creation of new links and nodes destructors allow the deletion of links and
nodes writers allow the creation and alteration of labels.
. Readers can extract answers to questions
.
Different types of semantic networks:
•Definitional Networks: These emphasize hierarchical relationships, focusing on the "is-a" connection between
concepts. For example, a definitional network might show "car is-a vehicle" and "vehicle is-a machine."
•Assertional Networks: Designed to state facts or propositions. These networks don't focus on hierarchies but rather
on specific relationships between concepts. An example could be "car has-a color" or "John works-at hospital."
•Implicational Networks: Use implication as the primary link between concepts. These networks encode rules that
allow for reasoning and inferring new knowledge. For instance, an implication network might have a rule "if bird then
has-wings" which lets you infer that "robin has-wings" since robin is a bird.
•Executable Networks: These go beyond just storing information. They incorporate mechanisms to perform actions or
calculations based on the network structure. This might involve marker passing or attached procedures within the
network.
•Learning Networks: As the name suggests, these networks can learn and adapt. They can build or modify their
structure based on new information or examples they are exposed to.
•Hybrid Networks: These combine elements from two or more of the above categories. For instance, a network might have a
core of definitional relationships with additional learning capabilities to adapt over time.
Solve Examples
Solution:
The Semantic network representation of above sentences is : pg 103
Puss is a calico.
Herb is a tuna.
Charlie is a tuna.
All tunas are fishes.
All calicos are cats,.
All cats like to eat all kinds of fishes.
2. Represent the following sentences into a semantic network.
Cat is pet.
Dog is pet.
cat, Dog and Fish have a tail.
fish lives in water.
Frame based Knowledge Representations
Frame-based knowledge representation is a method for storing information in artificial
intelligence (AI) systems. It uses a concept called a "frame" to organize knowledge about specific
entities or situations.
Frames provide a convenient structure for representing objects that are typical to a stereotypical
situations. The situations to present may be visual scenes, structure of complex physical objects,
etc. Frames are also useful for representing commonsense knowledge . As frames allow nodes to
have structures they can be regarded as three-dimensional representations of knowledge.
A frame is similar to a record structure and corresponding to the fields and values are slots and
slot filters. Basically it is a group of slots and filters that defines a stereotypical object. A single
frame is not much useful. Frame systems usually have collection of frames connected to each
other.
Here's a breakdown of how it works:
•Frames:
•A frame is a data structure that acts like a record. It consists of slots (attributes) and
fillers (values) that describe a specific entity or concept. For example, a frame for a car
might have slots for attributes like color, number of wheels, and type of engine.
•Slots:
•Slots represent the different features or properties of the concept being described. Each slot
can have a specific data type, like text, numbers, or even other frames (for nested structures).
•Fillers:
•Fillers provide the actual values for the slots in a frame. These values define the specific
characteristics of an instance. Imagine a red car with 4 wheels and a gasoline engine. That
would be the filler for the corresponding slots in the car frame.
Applications of Frame-based Systems:
Slots Fillers
Publisher Thomson
Title Expert Systems
Author Giarratano
Edition Third
Year 1998
Pages 600
Conceptual Dependencies:
Conceptual dependencies theory was developed by schank in 1973 to 1975 to represent the meaning of natural language
sentences. Cd representation of a sentence is not built using words in the sentence rather built using conceptual primitives which
give the intended meaning of words. Since it represents meaning of sentence using primitives but not the exact words in a
sentence.
> It helps in drawing inferences
> It is independent of the language
CD provides structures and specific set of primitives from which representation can be built.
1.Primitive Actions: Basic actions that can be combined to describe more complex activities. Examples include:
1. PTRANS: Physical transfer of an object (e.g., moving from one place to another).
2. ATRANS: Abstract transfer (e.g., transferring ownership or information).
3. MTRANS: Mental transfer (e.g., transferring information within one's mind).
2.Case Relations: Roles played by different entities in the actions. Common case relations include:
1.State Descriptions: Representing states or conditions of entities before and after actions. For example, an object
might be "owned" by someone before and "owned" by someone else after an action.
The scripts were introduced by Schank and Abelson introduced in 1977 that used CD framework.
The scripts were useful in describing certain stereotyped situations such as going to theater.
It consists of set of slots containing default values along with some information about the type of
values similar to frames.
It differs from FS as the values of the slots in the script must be ordered and have more
specialized roles.
In real world situations, We see that event tends to occur in known patterns because of causal
relationship to the occurrence of events
Components of Script Structure Knowledge Representation:
1.Entry Conditions:
1. Must be satisfied before events in the script can occur. Example: For a "restaurant script," the entry condition
might be that the person is hungry and has money.
2.Props:
1. Slots representing objects involved in the events.
3.Roles:
1. Persons involved in the events.
4.Scenes:
1. Scripts are broken down into smaller components called scenes, which represent specific actions or sets of
actions that occur as part of the larger event.
5.Tracks:
1. These represent alternative pathways or variations within the script, accounting for different possible
outcomes or sequences of events based on varying conditions.
6.Results:
1. These are the outcomes or end states resulting from the execution of the script. They describe the final
condition after the sequence of actions has taken place.
7.Subscripts:
1. These are smaller scripts that can be embedded within a larger script, representing detailed sequences for
more specific actions within the main event.
Restaurant Script:
1.Entry Conditions:
1. The person is hungry.
2. The person has money.
2.Props:
1. Menu, table, chair, utensils, food, bill.
3.Roles:
1. Customer, waiter, chef.
4.Scenes:
1. Entering: Customer enters the restaurant.
2. Seating: Waiter seats the customer.
3. Ordering: Customer orders food from the menu.
4. Eating: Chef prepares the food, and customer eats.
5. Paying: Customer receives the bill and pays.
5. Tracks:
1. Customer likes the food.
2. Customer dislikes the food and sends it back.
6. Results:
1. Customer is no longer hungry.
2. Customer has paid the bill.
7. Subscripts:
1. Paying Bill Subscript:
1.Waiter brings the bill.
2.Customer provides payment.
3.Waiter processes the payment.
Example: "Going to Meet the Doctor" Script
Entry Conditions:
•Feeling unwell or having a scheduled appointment.
•Access to transportation.
Props:
•Medical record, waiting room, examination room, medical equipment, prescription pad.
Roles:
•Patient, receptionist, nurse, doctor.
Scenes:
1.Arriving: Patient checks in.
2.Waiting: Patient waits in the waiting room.
3.Initial Examination: Nurse checks vital signs.
4.Consultation: Doctor discusses symptoms and performs an examination.
5.Diagnosis and Treatment: Doctor diagnoses and prescribes treatment.
6.Leaving: Patient schedules follow-up and leaves.
Tracks:
•Mild condition diagnosed and treated.
•Need for further tests or specialist referral.
•Immediate in-office treatment provided.
Results:
•Diagnosis and treatment plan.
•Patient reassured or informed of next steps.
•Prescription or treatment instructions provided.
Subscripts:
•Taking Vital Signs: Nurse measures and records vital signs.
•Scheduling Follow-Up: Receptionist schedules next appointment and provides confirmation.
Rule Based knowledge representation system:
A rule-base system (or production system) either knowledgeable based system in which the
knowledge is stored as rules; an export system is a RBSs in which the rules comes from human
experts in a particular domain.
The underlying idea of production system is to present knowledge in the form of condition action
pairs called production rules.
Rule based system can be used for problem solving or for control(animate motion). In RBS, the
knowledge is separated from the AI reasoning processed, which means that new RBS, are easy
to create.
Working Memory:- a small allocation of memory into which only appropriate rules are copied.
Rule Base:- The knowledge base is the heart of a rule-based system. It stores all the domain knowledge of the system in
the form of a set of rules.
Interpreter:- The processing engine which carries out reasoning on the rules and derives an answer.
User Interface:- The user interface allows users to interact with the rule-based system. Users can provide input data,
receive output from the system, and monitor the system's reasoning process.
> Match-memory contain matched against condition of production rules, this produces a subset of production called
conflict set.
> Conflict resolution – one of the production in the conflict set is then selected.
1.Syntax:
1. Symbols: Basic elements like variables, constants, predicates, and functions.
2. Formulas: Well-formed combinations of symbols that express propositions or relationships.
3. Logical Connectives: Operators like AND (∧), OR (∨), NOT (¬), IMPLIES (→) used to form complex sentences.
4. Quantifiers: Universal (∀) and existential (∃) quantifiers to express statements about all or some members of a
domain.
2.Semantics:
1. Defines the meaning of the syntactical elements and formulas.
2. Interpretations: Assigns truth values to sentences based on a specific model.
3. Models: Representations of a possible world where the sentences hold true.
3.Inference Mechanisms:
1. Deduction: Deriving logically valid conclusions from given premises.
2. Resolution: A common rule of inference used in automated theorem proving.
3. Modus Ponens: If 𝑃→𝑄 and 𝑃 are both true, then Q is true.
1.Knowledge Base:
1. A collection of facts and rules about the domain of interest.
2. Structured in a way that supports efficient querying and updating.
2.Reasoning Engines:
1. Tools that apply inference rules to the knowledge base to derive new information or make decisions.
2. Examples include Prolog interpreters and description logic reasoners.
1.Propositional Logic:
1. Simplest form of logic.
2. Deals with propositions that can be true or false.
3. Limited expressiveness as it cannot handle relationships between objects.
2.First-Order Logic (FOL)[predicate]:
1. Extends propositional logic by including objects, predicates, and quantifiers.
2. More expressive and can represent complex relationships and properties of objects.
3. Example: Predicate calculus.
3.Description Logic (DL):
1. A family of logics designed for representing structured knowledge.
2. Basis for ontologies and semantic web technologies like OWL (Web Ontology Language).
3. Balances expressiveness and computational tractability.
4.Modal Logic: 5. Fuzzy logic:
1. Extends classical logic to include modalities like necessity and possibility.
2. Used in reasoning about beliefs, knowledge, and temporal events.
Propositional Logic (PL):-
Propositional logic are formal languages for representing information such
that conclusions can be drawn: It has syntax and semantics:
Semantics define the meaning of sentences. That defines truth of a sentence in a world
Truth Tables
A truth table is a mathematical table used to determine the truth value of a logical expression
based on the truth values of its components. Here’s an example for basic connectives:
P Q -p P^Q PvQ P➔Q P ➔Q
False False True False False True True
False True Ture False True True False
True False False False True False False
True true false true True true True
Formal Logic-connectives :-
Syntax
We can use the formal logic connectives to construct logical statements:
1.𝑃→Q: (If it is raining, then the ground is wet.)
2.𝑃→R: (If it is raining, then I will take an umbrella.)
3.¬𝑃: (It is not raining.)
Semantics
The semantics of these statements involves interpreting their truth values. Let's assign truth
values to the propositions:
•𝑃: False (It is not raining.)
•𝑄: False (The ground is not wet.)
•𝑅: False (I will not take an umbrella.)
Validity in logic refers to a property of an argument or a deductive reasoning process. An argument is considered valid if and only
if it is impossible for the premises to be true and the conclusion to be false simultaneously. In other words, a valid argument
ensures that if the premises are true, the conclusion must necessarily be true.
Example of a Valid Argument
Premise 1: All humans are mortal. (If all humans are mortal, then anyone who is a human must be mortal)
Premise 2: Socrates is a human.
Conclusion: Socrates is mortal.
Here, the conclusion logically follows from the premises. If both premises are true, then the conclusion must also be true, making
the argument valid.
Formal Definition
In formal logic, an argument is valid if the truth of the premises guarantees the truth of the conclusion. This is often tested using
truth tables or proof techniques in formal systems like predicate logic.
Tautology
A tautology is a statement or formula that is true in every possible interpretation. In propositional logic, a tautology is a formula
that is always true regardless of the truth values of its component propositions.
Example of a Tautology
Statement: 𝑃∨¬𝑃
Precedence Operators
This argument is valid because if both premises are true, the conclusion must also be true. If it is true that "if it is raining, then
the ground is wet" and it is also true that "it is raining," then it must follow that "the ground is wet."
Truth Table for Validity
Well Formed Formula
In logic-based knowledge representation, a well-formed formula (WFF) is a formula that follows the specific rules
of a particular logic system. It's like a grammatically correct sentence in a language, but for logic. Here's a
breakdown:
•Logic System: There are different logic systems used for knowledge representation, like propositional logic and
first-order logic. Each system has its own set of symbols and rules for constructing valid formulas.
•Symbols: These can be propositional letters (representing basic statements), predicates (relations between
things), variables, and logical connectives (AND, OR, NOT, etc.).
•Rules: The rules define how these symbols can be combined to form meaningful formulas. They specify things
like the order of operations, proper use of parentheses, and valid combinations of symbols.
On the other hand, PQR (without connectives) or (P ∧ OR Q) (misusing connectives) would not be well-formed
formulas.
Here's why WFFs are important:
•Clarity: They ensure that formulas are unambiguous and can be interpreted consistently within the logic
system.
•Reasoning: Logical reasoning algorithms rely on WFFs to manipulate and draw conclusions from the
knowledge base.
•Efficiency: By following the rules, WFFs allow for efficient processing and analysis of knowledge.
Inference using Resolution in propositional
Inference Rules in PL:
1) Modus Ponens a=>b,a 2) And-elimination a^b
b b
Inference using resolution is a powerful technique in automated theorem proving within logic.
This is the core inference rule that allows you to derive new logical statements from existing ones. It works by
combining two clauses (disjunctions of literals) that share complementary literals (one positive, one negated) and
creating a new clause, the resolvent.
(UR) Unit Resolution: Unit resolution rule takes a clause (a disjunction of literals) and a literal and produces a new
clause. Single literal is also called unit clause.
• General Resolution: The unit resolution rule can be
generalized to the full resolution rule,
Proof by resolution
Resolution is used with knowledge bases in CNF(Conjunctive Normal Form) (or clausal form),
and is complete for propositional logic.
• Resolution takes two clauses and produces a new clause containing all the literals of the two
original clauses except the two complementary literals.
• In addition the resulting clause should contain only one copy of each literal. The removal of
multiple copies of literals is called factoring.
• For example, if we resolve (A ∨ B) with (A∨¬B), we obtain (A ∨ A), which is reduced to just A.
Resolution Algorithm
Pros and cons of propositional logic
Steps:
Given knowledge base of true facts:
•Goal-driven: It starts with a specific goal in mind and focuses on what needs to be done to reach
that goal.
•Step-by-step: It breaks down complex tasks into smaller, more manageable steps.
•Success-oriented: By starting with the final step and gradually working backwards, it allows for a
sense of accomplishment with each completed step.
First Order Logic (predicate logic)
First-order logic (FOL), also known as predicate logic or first-order predicate calculus, is a formal
system used in AI, and computer science. It extends propositional logic by allowing the use of
quantifiers and predicates, thereby enabling more expressive statements about objects and their
properties.
In the context of first-order logic (FOL), a predicate is a symbol or function that represents
a property of objects or a relationship between objects within the domain of discourse.
2.Constants: Symbols that refer to specific objects in the domain. Examples include 𝑎,𝑏,𝑐
6. Logical Connectives: Symbols used to build complex statements from simpler ones.
Common connectives include:
1. Conjunction (∧): "and"
2. Disjunction (∨): "or"
3. Negation (¬): "not"
4. Implication (→): "if...then"
5. Biconditional ( ): "if and only if"
Syntax and Semantics: FOL has two main parts
•Syntax: Defines the formal structure of well-formed formulas (WFFs) in FOL. A WFF might
be a simple atomic formula like P(a) or a complex formula involving quantifiers
and connectives, such as ∀𝑥(𝑃(𝑥)→∃𝑦𝑅(𝑥,𝑦)).
Syntax: ∀x(Animal(x)→Organism(x))
Symentic: The formula ∀𝑥(Animal(𝑥)→Organism(𝑥))∀x(Animal(x)→Organism(x)) is true if, for every object 𝑥 in the
domain D, whenever Animal(x) is true, Organism(𝑥) is also true.
Atomic Sentence:- Atomic sentences are the most basic sentences of first-order logic. These sentences are formed from a
predicate symbol followed by a parenthesis with a sequence of terms.
Example: Brother (Bill, Mary), [Bill is brother of mary] or b(x,y) [predicate b is : brother of , X is bill , y is mary]
Father (jack, John), Mother (jill, john), [jack is father of john], [jill is mother of john)
sister (jane, john),
married (jack, jill)
Translating natural language into First-Order Logic (FOL) can be Building the FOL Formula
challenging. Here are some tips to help you:
•Start with quantifiers: Introduce quantifiers for variables that
Understanding the Basics range over a domain.
•Define predicates: Use capital letters and appropriate
•Identify the key components: Quantifiers (∀, ∃), predicates, arguments.
constants, functions, and variables. •Use logical connectives: Combine predicates and quantifiers
•Grasp the logical connectives: ∧ (and), ∨ (or), ¬ (not), → using logical operators.
(implies), (if and only if). •Handle negation carefully: Ensure correct placement of
•Know the difference between predicates and functions: negation.
Predicates express properties or relations, while functions map
elements to other elements. Examples
•"All dogs bark": ∀x (Dog(x) → Barks(x))
Breaking Down the Sentence •"Some students like math": ∃x (Student(x) ∧ Likes(x, Math))
•"No one loves everyone": ¬∃x ∀y Loves(x, y)
•Identify the main verb: This often indicates a predicate.
•Determine the subject and objects: These can become •Confusing quantifiers: Ensure correct use of ∀ and ∃.
arguments for the predicate. •Misinterpreting negation: Place negation carefully.
•Look for quantifiers: Words like "all," "some," "every," and •Overlooking variables: Make sure all variables are properly
"no" usually indicate quantifiers. quantified.
•Consider the sentence structure: Pay attention to the order of •Ignoring sentence structure: Consider the order of words and
words and phrases. phrases.
By following these tips and practicing regularly, you can
improve your ability to translate English-like language into FOL.
Complex sentence: - Complex sentences are made from atomic sentences using connectives.
Sister (john, jane)
P(a)∧Q(b): A conjunction of two atomic sentences. This means "a has property P and b has property Q".
Properties of quantifiers
V x V y is same as V y V x
3x 3y is the same as 3y 3x
3x V y is not same as V y 3x
3x V y Loves (x,y)
“There is a person who loves everyone ins the world”
V y 3x loves (x,y)
“Everyone in the world is loved by at least one person”
FOPL Inference
There are many FOPL Inference method but we use here Resolution based method.
Resolution methods are a family of inference algorithms based on the resolution rule,
which is used to derive a contradiction from a set of clauses. These methods convert all
formulas into a standardized form, typically conjunctive normal form (CNF), and then apply
the resolution rule iteratively to derive new clauses until a contradiction is found or no
further inferences can be made.
first-order inference can be done by converting the knowledge base to propositional logic and using
propositional inference.
• Conversion can be done by using the following inference rules for quantifiers:
– Universal instantiation
– Existential instantiation
• King(John)
• Greedy(John)
• Brother (Richard, John) .
– Then we apply UI to the first sentence using all possible ground-term substitutions
from the vocabulary of the knowledge base (in this case, {x/John} and {x/Richard }).
– We obtain
– EI rule: the variable is replaced by a single new constant symbol does not appear elsewhere
in the knowledge base.
– Basically, the existential sentence says there is some object satisfying a condition, and
applying the existential instantiation rule just gives a name to that object.
– So, Existential Instantiation can be applied once, and then the existentially quantified
sentence can be discarded.
– For example, we no longer need ∃ x Kill(x, Ram) once we have added the sentence Kill (Hari ,
Ram).
∃y(book(y)∧OnTable(y,library))
Breakdown of Components
•∃𝑦: The existential quantifier, meaning "there exists some y".
•∧: Logical conjunction (AND), meaning both conditions must be true simultaneously.
"There exists at least one y such that 𝑦 is a book and 𝑦 is on a table in the library.“
Or
• Unification is the process of finding substitutions that make different logical expressions look identical.
• takes two sentences and returns a list of substitutions(unifier) to make two sentences match, or failure if no match
possible.
• i.e., UNIFY(p, q)=θ , are matched where θ is the list of substitutions in p and q
• Example: unification
Lifting
Lifting refers to the process of applying inference rules to first-order logic statements by
considering their general form (with quantifiers and variables) rather than their ground instances
(specific cases).
Example:
•From ∀𝑥(Human(𝑥)→Mortal(𝑥))∀x(Human(x)→Mortal(x)), we can infer
Human(𝑆𝑜𝑐𝑟𝑎𝑡𝑒𝑠)→Mortal(𝑆𝑜𝑐𝑟𝑎𝑡𝑒𝑠)Human(Socrates)→Mortal(Socrates) by lifting the rule to
the specific instance.
Handling Uncertain Knowledge
In Artificial Intelligence (AI), uncertain knowledge refers to the situations where an AI system lacks complete or
perfect information to make a definitive decision. This uncertainty can arise from various factors:
•Limited Data: If the data used to train an AI model is incomplete or not representative of the real world, the
model might not have enough information to make accurate predictions.
•Noisy Data: Real-world data often contains inconsistencies, errors, or missing values. This "noise" can make it
difficult for AI systems to learn clear patterns and lead to uncertain outcomes.
•Inherent Ambiguity: Some situations are inherently ambiguous, with multiple possible interpretations. For
example, an image recognition system might struggle to distinguish between a cat and a dog in a blurry picture.
AI systems employ various techniques to handle uncertainty Knowledge:
1. Random Variables 2. Prior and Posterior Probability 3. Inference Using Full Joint Distribution
4. Bayes’ Rule 5. Bayesian Networks 6. Fuzzy logic
Fuzzy logic can be viewed both as a knowledge representation system and as a technique for handling uncertain knowledge.
Random variable:
Random variables are variables that represent the possible outcomes of random processes.
For example, if you're rolling a fair six-sided die, the random variable could be the number showing on the top face after the roll,
which could be any number from 1 to 6.
P(A) = The number of ways Event A can Occur/The total number Of Possible Outcomes
Posterior Probability:- Posterior probability is the probability of one event occurring with some relationship to one or
more other events.
Suppose the factory produces two types of light bulbs, A and B. Light bulb A has a defect rate of 5%, while light bulb B has a
defect rate of 10%. However, 70% of the bulbs produced are of type A, and 30% are of type B.
Now, let's say you randomly select a light bulb from the factory's production line, but you don't know which type it is. You inspect
the bulb and find that it has a defect.
We want to calculate the posterior probability that the bulb you selected is of type A, given that it has a defect.
Let's define the events:
•Event 𝐴A: The bulb is of type A.
•Event 𝐵B: The bulb is of type B.
•Event 𝐷D: The bulb is defective.
We need to calculate:
𝑃(𝐴∣𝐷)=𝑃(𝐷∣𝐴)×𝑃(𝐴)𝑃(𝐷)P(A∣D)=P(D)P(D∣A)×P(A)
Where:
•𝑃(𝐴∣𝐷)P(A∣D) is the posterior probability that the bulb is of type A given that it has a defect.
•𝑃(𝐷∣𝐴)P(D∣A) is the probability that a bulb is defective given that it's of type A (5%).
•𝑃(𝐴)P(A) is the prior probability that a randomly selected bulb is of type A (70%).
•𝑃(𝐷)P(D) is the total probability of a defective bulb, which is the sum of the probabilities of the bulb being defective and of
type A plus the probability of the bulb being defective and of type B.
Plugging in the values:
𝑃(𝐴∣𝐷)=(0.05×0.70)(0.05×0.70+0.10×0.30)P(A∣D)=(0.05×0.70+0.10×0.30)(0.05×0.70)
𝑃(𝐴∣𝐷)=0.0350.035+0.030P(A∣D)=0.035+0.0300.035
𝑃(𝐴∣𝐷)=0.0350.065P(A∣D)=0.0650.035
𝑃(𝐴∣𝐷)≈0.538P(A∣D)≈0.538
So, given that the bulb you selected is defective, there's approximately a 53.8% chance that it is of
Inference using full joint distribution:-
Inference using the full joint distribution involves making predictions or drawing conclusions about
certain variables based on the complete probability distribution of all the variables involved in a given problem or scenario.
We have historical data on delivery times for various distances under different traffic conditions. This data can be used to
build a joint probability distribution, where each entry represents the probability of a specific delivery time given a
distance and traffic condition.
Distance (km) Traffic P(Distance, Traffic) Delivery Time (min)
5 L 0.3 30
5 H 0.2 60
10 L 0.2 45
10 H 0.3 90
Inference Task: A new delivery needs to be made at a distance of 8 kilometers. You want to predict the most likely
delivery time.
Real-world approach:
In practice, with continuous variables, full joint distribution tables become impractical.
Bayes’rule:-
Base rule or theorem is a way to apply conditional probability for prediction. Conditional
probability is the probability of an event happening, given that it has some relationship to
one or more other events.
For example your probability of getting a parking space is connected to the time of
day you park where you park and what conventions are going on at any time. Bayes’
theorem is slightly more notched.
P(A/B) = P(B/A)*P(A)/P(B)
Ex 1: Find out a patient’s probability of having liver disease if they are an alcoholic. “Being an
alcoholic” is the test for liver disease with following.
Let A could mean the event “Patient has liver disease.” past data tells you that 10% of patients entering your
clinic have liver disease. P(A)=0.10.
B could mean the litmus test that “Patient is an alcoholic.” Five percent of the clinic’s patients are alcoholics.
P(B)=0.05.
In other words, if the patient is an alcoholic, their chances of having liver disease is 0.14(14%).
A set of directed links connecting pairs of nodes. If there is an arrow from node X to node Y, X is said to be a parent of Y.
Each node Xi has a conditional probability distribution P(Xi) parents(Xi) that quantifies the effect of the parents on the
node.
Reasoning in Belief Networks:
Reasoning in a belief network, also known as a Bayesian network, involves using the
network structure and conditional probability tables (CPTs) to answer questions about the
state of the variables in the network. Key concept Involved :-
1. Network Structure:
2. Conditional Probability Tables (CPTs):
3. Inference Tasks:
4. Inference Algorithms:
Reasoning Process:
Reasoning process in a belief network:
1.Identify the Query: What do you want to find out? This determines the type of inference task (e.g.,
posterior probability).
2.Set the Evidence: Specify the values of some variables for which you have observations.
3.Apply an Inference Algorithm: Use an appropriate algorithm based on the network structure and the
type of inference task.
1.Obtain the Results: The algorithm will calculate the probabilities or most likely explanations based on
the evidence and the network structure.
Fuzzy logic:-
The word fuzzy refers to things which are not clear. Any event, process, or function that is changing continuously
cannot always be defined as either true or false, which means that we need to define such activities in a fuzzy manner.
Classical logic only permits conclusions which are either true or false. However, there are also propositions with variable answers,
such as one might find when asking a group of people to identify a color.
Take a look at the following diagram. It shows that in fuzzy systems, the values are indicated by a number in the range from 0 to
1. Here 1.0 represents absolute truth and 0.0 represents about falseness. The number which indicates the value in fuzzy systems
is called the truth value.
In other words we can say that Fuzzy logic is not logic that is Fuzzy, but logic that is used to
describe fuzziness. There can be numerous other examples like this with the help of which we
can understand the concept of fuzzy logic.
Fuzzy logic was introduced in 1965 by lofty A Zadeh in his research paper “fuzzy sets”. He is
considered as the father of Fuzzy Logic.
Fuzzy Set:
A set X in which each element y has a grade of membership ux(y) in the range 0 to 1.
For example: if cold is a fuzzy set, exact temperature values might be mapped to the fuzzy set as
follows:
. 15 degrees -> 0.2 (slightly cold)
. 10 degrees -> 0.5 (quite cold)
. 0 degrees -> 1 (totally cold)
Fuzzy sets can be considered as an extension and gross oversimplification of classical sets.
Basically it allows partial membership which means that it contain elements that have varying
degrees of membership in the set.
Membership in fuzzy set
In fuzzy logic, membership in a fuzzy set refers to the degree to which an element belongs to
that set. Unlike classical sets where membership is a binary decision (either in or out), fuzzy
sets allow for a gradual transition between belonging and not belonging. This degree of
membership is represented by a value between 0 and 1:
•Temperature between 65°F (18.3°C) and 72°F (22.2°C): Degree of membership gradually
increases from 0 to 1 (increasing comfort)
•Temperature between 72°F (22.2°C) and 78°F (25.5°C): Degree of membership stays at 1
(fully comfortable)
•More Natural Control: This approach allows for a smoother transition between heating and
cooling. As the temperature deviates slightly from the ideal range, the system can gradually
adjust the heating/cooling power based on the degree of membership in the "comfortable
temperature" set.
Fuzzification:-
The process of translating the major numerical values into fuzzy linguistic values is called
fuzzification. In other words, fuzzification is where membership functions are applied, and the degree of
membership is determined.
Defuzzification:-
Defuzzification is the process of producing a quantifiable result in fuzzy logic. The fuzzy inference will
output a fuzzy result, described in terms of degree of membership of the fuzzy sets. Defuzzification interprets the
membership degree in the fuzzy sets into a specific action or real value.
Advantages of Fuzzy logic System:-