The Steps Associated With The Knowledge Engineering
The Steps Associated With The Knowledge Engineering
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.
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
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
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:
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
This claim that no output are known at X1 for the input cases 10 and 01. Therefore the axiom for XOR
gate is considered
It the input signal are known 1 and 0 , the above sentence reduces to Signal(Out(1,X1)) = 11#0
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)
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
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
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
“
• 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:
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
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