0% found this document useful (0 votes)
150 views

The Steps Associated With The Knowledge Engineering

The seven steps of the knowledge engineering process are: 1. Identify the task to be solved using knowledge representation 2. Assemble relevant domain knowledge 3. Define terms and relations using predicates, functions, and constants 4. Encode general rules about the domain 5. Encode a specific problem instance 6. Pose queries to the knowledge base 7. Debug the knowledge base by testing assumptions The document then illustrates these steps by applying them to represent knowledge about electronic circuits.

Uploaded by

Lakhya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views

The Steps Associated With The Knowledge Engineering

The seven steps of the knowledge engineering process are: 1. Identify the task to be solved using knowledge representation 2. Assemble relevant domain knowledge 3. Define terms and relations using predicates, functions, and constants 4. Encode general rules about the domain 5. Encode a specific problem instance 6. Pose queries to the knowledge base 7. Debug the knowledge base by testing assumptions The document then illustrates these steps by applying them to represent knowledge about electronic circuits.

Uploaded by

Lakhya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

(1) What are the steps associated with the knowledge Engineering process?

Discuss them by applying the steps to any real world application of your choice.
Knowledge Engineering
The general process of constructing knowledge base is called knowledge engineering. A
knowledge engineer is someone who investigates a particular domain, learns what concepts are
important in that domain, and creates a formal representation of the objects and relations in the
domain. We will illustrate the knowledge engineering process in an electronic circuit domain that
should already be fairly familiar,
The steps associated with the knowledge engineering process are :
1 Identify the task.
The task will determine what knowledge must be represented in order to connect problem instances to
answers. This step is analogous to the PEAS process for designing agents.
2. Assemble the relevant knowledge. The knowledge engineer might already be an expert in the domain,
or might need to work with real experts to extract what they know-a process called knowledge
acquisition.
3. Decide on a vocabulary of predicates, functions, and constants. That is, translate the important
domain-level concepts into logic-level names. Once the choices have been made. the result is a
vocabulary that is known as the ontology of the domain. The word ontology means a particular theory of
the nature of being or existence.
4. Encode general knowledge about the domain. The knowledge engineer writes down the axioms for
all the vocabulary terms. This pins down (to the extent possible) the meaning of the terms, enabling the
expert to check the content. Often, this step reveals misconceptions or gaps in the vocabulary that must be
fixed by returning to step 3 and iterating through the process.
5. Encode a description of the specific problem instance
For a logical agent, problem instances are supplied by the sensors, whereas a "disembodied" knowledge
base is supplied with additional sentences in the same way that traditional programs are supplied with
input data.
6. Pose queries to the inference procedure and get answers. This is where the reward is: we can let the
inference procedure operate on the axioms and problem-specific facts to derive the facts we are interested
in knowing.
7. Debug the knowledge base.
x NumOfLegs(x,4) => Mammal(x) Is false for reptiles ,amphibians.

To understand this seven-step process better, we now apply it to an extended example-the


domain of electronic circuits.
The electronic circuits domain
One bit adder

1
1 Identify the task
There are many
ny reasoning tasks associated with digital circuits. At the highest level, one analyzes
the circuit's functionality. For example, what are all the gates connected to the first input terminal? Does
the circuit contain feedback loops? These will be our tasks in this section.
2 Assemble the relevant knowledge
What do we know about digital circuits? For our purposes, they are composed of wires and gates.
Signals flow along wires to the input terminals of gates, and each gate produces a signal on the output
terminal
rminal that flows along another wire.
3 Decide on a vocabulary
We now know that we want to talk about circuits, terminals, signals, and gates. The next step is to choose
functions, predicates, and constants to represent them. We will start from individual gates and move up to
circuits.
First, we need to be able to distinguish a gate from other gates. This is handled by naming gates with
constants: X I , X2, and so on
Type(X1) = XOR
Type(X1, XOR) –binary
binary predicate
XOR(X1) –individual
individual type
Agate or circuit can have one or more terminal. For X1 the terminals are X1In1, X1In2, X1Out1

X1In1- 1st input of gate X1


X1In2 -2nd input of gate X1
X1Out1-Output of gate X1
4 Encode general knowledge of the domain
One sign that we have a good ontology is that
that there are very few general rules which need to be specified.
A sign that we have a good vocabulary is that each rule can be stated clearly and concisely. With our
example, we need only seven simple rules to describe everything we need to know about circu
circuits:

1. If two terminals are connected, then they have the same signal:
t1,t2 Connected(t1, t2)  Signal(t1) = Signal(t2)

2
2. The signal at every terminal is either 1 or 0 (but not both):
t Signal(t) = 1  Signal(t) = 0
1≠0

3. Connected is a commutative predicate:

t1,t2 Connected(t1, t2)  Connected(t2, t1)

4. An OR gate's output is 1 if and only if any of its inputs is 1:

g Type(g) = OR  Signal(Out(1,g)) = 1  n Signal(In(n,g)) = 1

5. An A.ND gate's output is 0 if and only if any of its inputs is 0:

g Type(g) = AND  Signal(Out(1,g)) = 0  n Signal(In(n,g)) = 0

6. An XOR gate's output is 1 if and only if its inputs are different:


g Type(g) = XOR  Signal(Out(1,g)) = 1  Signal(In(1,g)) ≠ Signal(In(2,g))

7. A NOT gate's output is different from its input:

g Type(g) = NOT  Signal(Out(1,g)) ≠ Signal(In(1,g))


5 Encode the specific problem instance
The circuit shown in Figure is encoded as circuit C1 with the following description. First,we categorize
the gates:
Type(X1)= XOR Type(X2)= XOR

Type(X1) = XOR Type(X2) = XOR


Type(A1) = AND Type(A2) = AND
Type(O1) = OR
Connected(Out(1,X1),In(1,X2)) Connected(In(1,C1),In(1,X1))
Connected(Out(1,X1),In(2,A2)) Connected(In(1,C1),In(1,A1))
Connected(Out(1,A2),In(1,O1)) Connected(In(2,C1),In(2,X1))
Connected(Out(1,A1),In(2,O1)) Connected(In(2,C1),In(2,A1))
Connected(Out(1,X2),Out(1,C1)) Connected(In(3,C1),In(2,X2))
Connected(Out(1,O1),Out(2,C1)) Connected(In(3,C1),In(1,A2))

6 Pose queries to the inference procedure


What combinations of inputs would cause the first output of Cl (the sum bit) to be 0 and the second
output of C1 (the carry bit) to be l?
i1,i2,i3,o1,o2 Signal(In(1,C1)) = i1  Signal(In(2,C1)) = i2  Signal(In(3,C1)) = i3 
Signal(Out(1,C1)) = 0  Signal(Out(2,C1)) = 1

3
The answer are substitutions for the variable i1,i2 and i3 such that the resulting sentence is entailed by
the knowledge base, There are three such substitutions:

{i1/1,i2/1,i3/0} {i1/2,i2/0,i3/1} {i1/0,i2/1,i3/1}

7 Debug the knowledge base

The knowledge base is checked with different constraints. For example if the assertion 1#0 is not
included in the knowledge base then it is variable to prove any output for the circuit ,expect for the input
cases 000 and 110

i1,i2,o Signal(In(1,C1)) = i1  Signal(In(2,C1)) = i2  Signal(Out(1,X1))

This claim that no output are known at X1 for the input cases 10 and 01. Therefore the axiom for XOR
gate is considered

Signal(Out(1,X1)) = 1  Signal(In(1,X1)) ≠ Signal(In(2,X1))

It the input signal are known 1 and 0 , the above sentence reduces to Signal(Out(1,X1)) = 11#0

Now the system is unable to infer the Signal(Out(1,X1)) =1

Unification
Generalized Modus Pones
• For atomic sentences pi, pi’, q where there is a substitution q such that Subst{q,
pi’} = Subst{q, pi}:

4
Unification
 It is the process of finding substitutions that make two atomic sentences identical
 Lifted inference rules require finding substitution that make different logical expression
look identical this process is called unification
 It is the key component of first order inference logic algorithm
UNIFY (p,q)=θ Where SUBST(θ,p)= SUBST(q, θ)
Θ- Unifier of two sentences
P-S1(x,x)
Q-S1(y,z)
Assume θ=y
Unification algorithm returns failure as the result at two factors
i) Two sentence have different predicate name
Ex hate(m,c)
try(m,c)
ii) Two sentence will have different number of arguments
Ex hate(m,c,x)
hate(m,c)
Query Knows (John,x) whom does john knows
The knowledg e base contain the following information
Knows(John,x)
Knows(John,Jane)
Knows(y,Bill)
Knows(y,Mother(y))
Knows(x,Eizabeth)

Consider the last sentence:

5
• This fails because x cannot take on two values
• But “Everyone knows Elizabeth” and it should not fail
• Must standardize apart one of the two sentences to eliminate reuse of variable

Standardizing apart eliminates overlap of variables, e.g., Knows(z17, OJ) by renaming its
variables to avoid name clashes
Most General Unifier
Multiple unifiers are possible:

or

Which is better, Knows (John, z) or Knows (John, John)?


• Second could be obtained from first with extra subs
• First unifier is more general than second because it places fewer restrictions on
the values of the variables
There is a single most general unifier for every unifiable pair of expressions
Occur Check
t1 = likes(X, Y)
t2 = likes(g(Y),
An equation that has a variable on one side and a term containing that variable on the
other side cannot be solved no matter what the substitute is. So the unification fails. The above
phenomenon is called "occurs check".
Unification algorithm

6
Storage and retrieval
Once the data type for sentences and terms are defined, we need to contain a set of sentences in a
KB
i) Stores(s) – store a sentence s
ii) Fetch(s)-returns all unifiers
such that query q unifies with some sentence in KB.
An example is when we ask Knows (John, x) – is an instance of fetching
 The simplest way to implement STORE and FETCH is to keep all the facts in the
knowledge base in one long list
 The given query UNIFY(q,s) – given query call for every sentence s in the list, requires
O(n) time on an n-element KB.
 Such a process is inefficient in terms of time taken because it will unify each and every
statement of knowledge base
 Inefficient because we’re performing so many unifies.

7
• Example: unify Knows (John, x) with Brother (Richard, John)
There is no need to unify
 We can avoid such unification by indexing the facts in the knowledge base
 Predicate indexing puts all the Knows facts in one bucket and all the Brother facts in
another
 The bucket stored in a hash table for efficient access.
 We can large bucket problem with the help of multiple indexing
• Might not be a win if there are lots of clauses for a particular predicate symbol
 Consider how many people Know one another

– Instead index by predicate and first argument


 Clauses may be stored in multiple buckets
Subsumption lattice
The above set of queries are said to form a collection tree called as Subsumption lattice
How to construct indices for all possible queries that unify with it
• Example: Employs (AIMA.org, Richard)

Properties of subsumption lattice


• The child of any node in the lattice is obtained from its parent by single
substitution
• The “highest” common descendent of any two nodes is the result of applying the
most general unifier
• The portion of lattice , above any ground fact can bd e construct
• Predicate with n arguments will create a lattice with O(2n) nodes
• Benefits of indexing may be outweighed by cost of storing and maintaining
indices

8
9
10
11
12
13
14
9 Man(x5)v person(x5)

15
2. Explain Forward and backward chaining (NOV 2013)(MAY 2013)(MAY 2012)(NOV 2011).
A forward-chaining algorithm for propositional definite clauses was already given. The
idea is simple: start with the atomic sentences in the knowledge base and apply
ModusPonens in the forward direction, adding new atomic sentences, until no
further inferences can be made.
First-order definite clauses
First-order definite clauses closely resemble propositional definite clauses they are
disjunctions of literals of which exactly one is positive. A definite clause either is atomic
or is an implication whose antecedent is a conjunction of positive literals and
whose consequent is a single positive literal.
This knowledge base contains no function symbols and is therefore an instance of' the
class DATALOG of Data log knowledge bases-that is, sets of first-order definite clauses with
no function symbols

• Nono… has some missles


16
• All of its missiles were sold to it by Colonel West

• We also need to know that missiles are weapons

• and we must know that an enemy of America counts as “hostile”


• West, who is American”

Nono, is a nation
Nation(nono)
• The country Nono, an enemy of America

America is a nation
Nation (America)

17
Analyse the algorithm
Sound
• Does it only derive sentences that are entailed?
• Yes, because only Modus Ponens is used and it is sound
Complete
• Does it answer every query whose answers are entailed by the KB?
• Yes if the clauses are definite clauses
Assume KB only has sentences with no function symbols
• What’s the most number of iterations through algorithm?
• Depends on the number of facts that can be added
Let k be the arity, the max number of arguments of any predicate and
Let p be the number of predicates
Let n be the number of constant symbols
• At most pnk distinct ground facts
• Fixed point is reached after this many iterations
• A proof by contradiction shows that the final KB is complete
Three sources of complexity
• inner loop requires finding all unifiers such that premise of rule unifies with facts
of database
– this “pattern matching” is expensive
• must check every rule on every iteration to check if its premises are satisfied
• many facts are generated that are irrelevant to goal

18
Step1:

Step2:

Step3:

19
Efficiency of forward chaining
 Incremental forward chaining: no need to match a rule on iteration k if a premise wasn't
added on iteration k-1

match each rule whose premise contains a newly added positive literal
 Matching itself can be expensive:

 Database indexing allows O(1) retrieval of known facts

e.g., query Missile(x) retrieves Missile (M1)


Forward chaining is widely used in deductive databases
Backward chaining
In backward chaining, we start from a conclusion, which is the hypothesis we wish to prove, and
we aim to show how that conclusion can be reached from the rules and facts in the data base.
To determine if a decision should be made, work backwards looking for justifications for
the decision,
The conclusion we are aiming to prove is called a goal ,and the reasoning in this way is
known as goal-driven.
Eventually, a decision must be satisfied by facts

20
The algorithm uses composition of substitution. COMPOSE(θ1, θ2) is the substitution whose
effect is identical to the effect of applying each substitution is
SUBST(COMPOSE(θ1, θ2), p) = SUBST(θ2, SUBST(θ1, p))
In the algorithm , the current variable binding , which are stored in θ, are composed with the
binding resulting from unifying the goal with the clause head , given a new set of current
bindings for the recursive call.
Step1

Step2

Step 3

21
Step 4

Step 5

Step 6

22
Step 7

properties of backward chaining


Depth-first recursive proof search: space is linear in size of proof
Incomplete due to infinite loops  fix by checking current goal against every goal on stack
Inefficient due to repeated subgoals (both success and failure)
 fix using caching of previous results (extra space)
Widely used for logic programming: prolog

Two marks
1 What is Ontological Engineering
Ontology refers to organizing everything in the world into hierarch of categories.
Representing the abstract concepts such as Actions,Time,Physical Objects, and Beliefs is
called Ontological Engineering

23
2 1Define diagnostic rules with example?
Diagnostic rules are used in first order logic for inferencing. The diagnostic rules
generate hidden causes from observed effect. They help to deduce hidden facts in the world. For
example considering the wumpum world.
The diagnostic rule finding ‘pit’ is,
“If square is breezy some adjacent square must contain pit”, which is written as,
∀ Breezy(s)=> ∃ Adjacent(r,s)^ pit (r

4
S. No Propositional logic Predicate logic
1 It is less expressive power It is more expressive power
2 It cannot represent relationship among objects It represent relationship among objects
3 It does not use quantifiers It use quantifiers
4 It does not consider generalization of objects It consider generalization of objects

24

You might also like