Unit 1 SC

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Knowledge Representation

● Artificial intelligence is a system that is concerned with the study of


understanding, designing and implementing the ways, associated with
knowledge representation to computers.
● In any intelligent system, representing the knowledge is supposed to be an
important technique to encode the knowledge.
● The main objective of AI system is to design the programs that provide
information to the computer, which can be helpful to interact with humans and
solve problems in various fields which require human intelligence.
● Knowledge is an useful term to judge the understanding of an individual on a
given subject.

Issues in knowledge representation

The main objective of knowledge representation is to draw the conclusions from the
knowledge, but there are many issues associated with the use of knowledge
representation techniques.

1. Important attributes
2. Relationships among attributes
3. Choosing the granularity of representation
4. Representing sets of objects.
5. Finding the right structure as needed

Propositional Logic (PL)

● Propositional logic is a study of propositions.


● Each proposition has either a true or a false value but not both at a time.
● Propositions is represented by variables.
For example: Symbols 'p' and 'q' can be used to represent propositions.

There are two types of propositions:


1. Simple Preposition
2. compound Prepositions.

1. A simple preposition: It does not contain any other preposition.


For example: Rocky is a dog.

2. A compound preposition: It contains more than one prepositions.


For example: Surendra is a boy and he likes chocolate.

Connectives and the truth tables of compound prepositions are given below:
Consider 'p' and 'q' are two prepositions then,

1. Negation (¬p) indicates the opposite of p.


Truth table for negation:

p ¬p
0 1
1 0

2. Conjunction (p ∧ q) indicates that p and q both and are enclosed in parenthesis. So,
p and q are called conjuncts .
Truth table for conjunction:

p q p∧q
0 0 0
0 1 0
1 0 0
1 1 1

3. Disjunction (p ∨ q) indicates that either p or q or both are enclosed in parenthesis.


Thus, p and q are called disjuncts.
Truth table for disjunction:

p q p∨q
0 0 0
0 1 1
1 0 1
1 1 1
4. Implication (p ⇒ q) consists of a pair of sentences separated by the ⇒ operator and
enclosed in parentheses. The sentence to the left of the operator is called as an
antecedent, and the sentence to the right is called as the consequent.
Truth table for implication:

p q p⇒q
0 0 1
0 1 1
1 0 0
1 1 1

5. Equivalence (p ⇔ q) is a combination of an implication and a reduction.


Truth table for Equivalence:

p q p⇔q
0 0 1
0 1 0
1 0 0
1 1 1

Properties of Operators:

○ Commutativity:
○ P∧ Q= Q ∧ P, or
○ P ∨ Q = Q ∨ P.
○ Associativity:
○ (P ∧ Q) ∧ R= P ∧ (Q ∧ R),
○ (P ∨ Q) ∨ R= P ∨ (Q ∨ R)
○ Identity element:
○ P ∧ True = P,
○ P ∨ True= True.
○ Distributive:
○ P∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R).
○ P ∨ (Q ∧ R) = (P ∨ Q) ∧ (P ∨ R).
○ DE Morgan's Law:
○ ¬ (P ∧ Q) = (¬P) ∨ (¬Q)
○ ¬ (P ∨ Q) = (¬ P) ∧ (¬Q).
○ Double-negation elimination:
○ ¬ (¬P) = P.

Predicate Logic – Definition


A predicate is an expression of one or more variables defined on some specific domain.
A predicate with variables can be made a proposition by either assigning a value to the
variable or by quantifying the variable.
The following are some examples of predicates −
​ Let E(x, y) denote "x = y"
​ Let X(a, b, c) denote "a + b + c = 0"
​ Let M(x, y) denote "x is married to y"

Quantifiers
The variable of predicates is quantified by quantifiers. There are two types of
quantifier in predicate logic − Universal Quantifier and Existential Quantifier.

Universal Quantifier
Universal quantifier states that the statements within its scope are true for every value
of the specific variable. It is denoted by the symbol ∀

Example − "Man is mortal" can be transformed into the propositional form


∀xP(x) where P(x) is the predicate which denotes x is mortal and the universe of
discourse is all men.
Existential Quantifier
Existential quantifier states that the statements within its scope are true for some
values of the specific variable. It is denoted by the symbol


Example − "Some people are dishonest" can be transformed into the propositional
form

∃xP(x) where P(x) is the predicate which denotes x is dishonest and the universe of
discourse is some people.

Nested Quantifiers
If we use a quantifier that appears within the scope of another quantifier, it is called
nested quantifier.
Example
​ ∀ a∃bP(x,y)where P(a,b) denotes a+b=0

Monotonic Reasoning
● Monotonic Reasoning is the process that does not change its direction or can say
that it moves in the one direction.
● Monotonic Reasoning will move in the same direction continuously means it will
either move in increasing order or decrease.
● But since Monotonic Reasoning depends on knowledge and facts, It will only
increase and will never decrease in this reasoning.
Example:
Sun rises in the East and sets in the West.
Non-monotonic Reasoning
● Non-monotonic Reasoning is the process that changes its direction or values as
the knowledge base increases.
● It is also known as NMR in Artificial Intelligence.
● Non-monotonic Reasoning will increase or decrease based on the condition.
● Since Non-monotonic Reasoning depends on assumptions, It will change itself
with improving knowledge or facts.
Example:
Consider a bowl of water, If we put it on the stove and turn the flame on it will
obviously boil hot and as we will turn off the flame it will cool down gradually.

Monotonic
Non-Monotonic Reasoning
Reasoning

Monotonic Reasoning is the Non-monotonic Reasoning is the


process which does not change process which changes its
1
its direction or can say that it direction or values as the
moves in the one direction. knowledge base increases.

Monotonic Reasoning deals with Non-monotonic reasoning deals


2 very specific type of models, with incomplete or not known
which has valid proofs. facts.

The addition in knowledge will


The addition in knowledge won’t
3 invalidate the previous conclusions
change the result.
and change the result.
In non-monotonic reasoning,
In monotonic reasoning, results
results and set of prepositions will
4 are always true, therefore, set of
increase and decrease based on
prepositions will only increase.
condition of added knowledge.

Monotonic Reasoning is based Non-monotonic Reasoning is


5
on true facts. based on assumptions.

Abductive Reasoning and Human


Deductive Reasoning is the type
6 Reasoning is a non-monotonic
of monotonic reasoning.
type of reasoning.

Forward Reasoning
Forward reasoning is a process in artificial intelligence that finds all the possible
solutions of a problem based on the initial data and facts. Thus, the forward reasoning
is a data-driven task as it begins with new data. The main objective of the forward
reasoning in AI is to find a conclusion that would follow. It uses an opportunistic type
of approach.

Forward reasoning flows from incipient to the consequence. The inference engine
searches the knowledge base with the given information depending on the
constraints. The precedence of these constraints have to match the current state.

Backward Reasoning
Backward reasoning is the reverse process of the forward reasoning in which a goal or
hypothesis is selected and it is analyzed to find the initial data, facts, and rules.
Therefore, the backward reasoning is a goal driven task as it begins with conclusions
or goals that are uncertain. The main objective of the backward reasoning is to find
the facts that support the conclusions.

Backward reasoning uses a conservative type of approach and flows from


consequence to the incipient. The system helps to choose a goal state and reasons in
a backward direction. The first step in the backward reasoning is that the goal state
and rules are selected. Then, sub-goals are made from the selected rule, which need
to be satisfied for the goal state to be true.

The initial conditions are set such that they satisfy all the sub-goals. Also, the
established states are matched to the initial state provided. If the condition is fulfilled,
the goal is the solution, otherwise the goal is rejected. Therefore, backward reasoning
follows bottom-up technique.

Backward reasoning is also known as a decision-driven or goal-driven inference


technique because the system selects a goal state and reasons in the backward
direction.

weak slot and filler structure:


• The knowledge in slot and filler systems consists of structures as a set of entities and
their attributes. .
• This structure is called a weak slot and filler structure.
strong slot and filler structure: • But later we used strong slot and filler structures. It
represent links between objects according to more rigid rules.
Semantic network
• Semantic networks became popular in artificial intelligence and natural language
processing only because it represents knowledge or supports reasoning.
• These act as another alternative for predicate logic in a form of knowledge
representation. Semantic nets consist of nodes, links and link label.

Frames
• A frame is an artificial intelligence data structure used to divide knowledge into
substructures by representing "stereotyped situations.
• " Frames are the primary data structure used in artificial intelligence frame language.

Scripts
• A script is a structured representation describing a stereotyped sequence of events in
a particular context.
• Scripts are used in natural language understanding systems to organize a knowledge
base in terms of the situations that the system should understand.

NLP
Natural Language Processing (NLP) refers to AI method of communicating with an
intelligent systems using a natural language such as English.

Processing of Natural Language is required when you want an intelligent system like
robot to perform as per your instructions, when you want to hear decision from a
dialogue based clinical expert system, etc.

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.
○ 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 role of words in the sentence and in phrases.
○ Semantics − It is concerned with the meaning of words and how to
combine words into meaningful phrases and sentences.
○ Pragmatics − It deals with using and understanding sentences in different
situations and how the interpretation of the sentence is affected.
○ Discourse − It deals with how the immediately preceding sentence can
affect the interpretation of the next sentence.
○ World Knowledge − It includes the general knowledge about the world.

Steps in NLP
There are general five steps −

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 immediately succeeding sentence.
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.

NPL Application:
● Spam detection:
● Machine translation:
● Virtual agents and chatbots:
● Social media sentiment analysis:
● Text summarization:

You might also like