CPECSC 481 KnowledgeBased Systems Dr Franz J Kurfess
CPE/CSC 481: Knowledge-Based Systems Dr. Franz J. Kurfess Computer Science Department Cal Poly © 2002 Franz J. Kurfess Knowledge Representation 1
Course Overview u Introduction u Knowledge u Semantic Nets, Frames, Logic u Reasoning u with Uncertainty Probability, Bayesian Decision Making u Expert u and Inference Predicate Logic, Inference Methods, Resolution u Reasoning u Representation System Design u CLIPS u Overview Concepts, Notation, Usage u Pattern u Matching Variables, Functions, Expressions, Constraints u Expert System Implementation u Salience, Rete Algorithm u Expert System Examples u Conclusions and Outlook ES Life Cycle © 2002 Franz J. Kurfess Knowledge Representation 2
Overview Knowledge Representation u Motivation u Knowledge u Objectives Methods u Chapter u u u Introduction Review of relevant concepts Overview new topics Terminology u Knowledge u u u and its Meaning Epistemology Types of Knowledge Pyramid © 2002 Franz J. Kurfess u u Representation Production Rules Semantic Nets Schemata and Frames Logic u Important Concepts and Terms u Chapter Summary Knowledge Representation 3
Logistics u Term Project u Lab and Homework Assignments u Exams u Grading © 2002 Franz J. Kurfess Knowledge Representation 4
Bridge-In © 2002 Franz J. Kurfess Knowledge Representation 5
Pre-Test © 2002 Franz J. Kurfess Knowledge Representation 6
Motivation © 2002 Franz J. Kurfess Knowledge Representation 7
Objectives © 2002 Franz J. Kurfess Knowledge Representation 8
Knowledge and its Meaning u Epistemology u Types of Knowledge u Knowledge Pyramid © 2002 Franz J. Kurfess Knowledge Representation 11
Epistemology u the science of knowledge EPISTEMOLOGY ( Gr. episteme, "knowledge"; logos, "theory"), branch of philosophy concerned with theory of knowledge. The main problems with which epistemology is concerned are the definition of knowledge and related concepts, the sources and criteria of knowledge, the kinds of knowledge possible and the degree to which each is certain, and the exact relation between the one who knows and the object known. [Infopedia 1996] © 2002 Franz J. Kurfess Knowledge Representation 12
Knowledge Definitions knowlaedge 'n. S-lij n [ME knowlege, fr. knowlechen to acknowledge, irreg. fr. knowen ] (14 c) 1 obs : cognizance 2 a (1) : the fact or condition of knowing something with familiarity gained through experience or association (2) : acquaintance with or understanding of a science, art, or technique b (1) : the fact or condition of being aware of something (2) : the range of one's information or understanding <answered to the best of my 4> c : the circumstance or condition of apprehending truth or fact through reasoning : cognition d : the fact or condition of having information or of being learned <a man of unusual 4> 3 archaic : sexual intercourse 4 a : the sum of what is known : the body of truth, information, and principles acquired by mankind b archaic : a branch of learning syn knowledge, learning, erudition, scholarship mean what is or can be known by an individual or by mankind. knowledge applies to facts or ideas acquired by study, investigation, observation, or experience <rich in the knowledge of human nature>. learning applies to knowledge acquired esp. through formal, often advanced, schooling <a book that demonstrates vast learning >. erudition strongly implies the acquiring of profound, recondite, or bookish learning <an erudition unusual even in a scholar>. scholarship implies the possession of learning characteristic of the advanced scholar in a specialized field of study or investigation <a work of first-rate literary scholarship >. © 2002 Franz J. Kurfess [Merriam-Webster, 1994] Knowledge Representation 13
David Hume u Scottish empiricist philosopher, whose avowed aim was to secure the foundation of knowledge by demonstrating that 'false and adulterate metaphysics' only arises when we address subjects beyond the scope of human reason. He used the principle that all legitimate ideas must be derived from experience to cast doubt on the reality of the self and of causal connection. He claimed that inductive reasoning cannot be justified; it is merely a 'habit or custom', a 'principle of human nature'. © 2002 Franz J. Kurfess [Guinness 1995] Knowledge Representation 14
Immanuel Kant u Immanuel Kant, 18 th-century German philosopher and scientist. In the Critique of Pure Reason (1781) he suggested that human understanding contributes twelve categories, which are not learnt from experience but which form the conceptual framework by virtue of which we make sense of it. Similarly, the unity of science is not discovered by science but is what makes science possible. He believed, however, that by transcendental argument it is possible to infer the bare existence of a world beyond experience. © 2002 Franz J. Kurfess Knowledge Representation 15
Types of Knowledge ua priori knowledge u u ua comes before knowledge perceived through senses considered to be universally true posteriori knowledge u u knowledge verifiable through the senses may not always be reliable u procedural u knowing how to do something u declarative u knowledge knowing that something is true or false u tacit u knowledge not easily expressed by language © 2002 Franz J. Kurfess Knowledge Representation 16
Knowledge in Expert Systems Conventional Programming Algorithms + Data Structures = Programs Knowledge-Based Systems Knowledge + Inference = Expert System N. Wirth © 2002 Franz J. Kurfess Knowledge Representation 17
Knowledge Pyramid Meta. Knowledge Information Data Noise © 2002 Franz J. Kurfess Knowledge Representation 18
Knowledge Representation Methods u Production Rules u Semantic Nets u Schemata and Frames u Logic © 2002 Franz J. Kurfess Knowledge Representation 19
Production Rules u frequently used to formulate the knowledge in expert systems u formal variation is Backus-Naur form (BNF) u metalanguage for the definition of language syntax u a grammar is a complete, unambiguous set of production rules for a specific language u a parse tree is a graphic representation of a sentence in that language u provide only a syntactic description of the language v not all sentences make sense © 2002 Franz J. Kurfess Knowledge Representation 20
Example 1 Production Rules u for a subset of the English language <sentence> -> <subject> <verb> <object> <modifier> -> <noun> <object> -> <noun> -> man | woman <verb> -> loves | hates | marries | divorces <modifier> -> a little | a lot | forever | sometimes Example sentence: man loves woman forever <sentence> <subject> Example parse tree: man © 2002 Franz J. Kurfess loves woman forever Knowledge Representation 21
Example 1 Parse Tree u for a subset of the English language <sentence> <subject> <verb> <noun> man © 2002 Franz J. Kurfess <object> <modifier> <noun> loves woman forever Knowledge Representation 22
Example 2 Production Rules u for a subset of the German language <sentence> -> <subject phrase> <verb> <object phrase> <subject phrase> -> <determiner> <adjective> <noun> <object phrase> -> <determiner> <adjective> <noun> <determiner> -> der | die | das | den <noun> -> Mann | Frau | Kind | Hund | Katze <verb> -> mag | schimpft | vergisst| verehrt | verzehrt <adjective> -> schoene | starke | laute | duenne | © 2002 Franz J. Kurfess Knowledge Representation 23
Example 2 Parse Tree u construct a sample sentence according to the German grammar in the previous slide, and draw its corresponding parse tree <sentence> © 2002 Franz J. Kurfess Knowledge Representation 24
Advantages of Production Rules u simple and easy to understand u straightforward implementation in computers possible u formal foundations for some variants © 2002 Franz J. Kurfess Knowledge Representation 25
Problems with Production Rules u simplementations are very inefficient u some types of knowledge are not easily expressed in such rules u large sets of rules become difficult to understand maintain © 2002 Franz J. Kurfess Knowledge Representation 26
Semantic Nets u graphical representation for propositional information u originally developed by M. R. Quillian as a model for human memory u labeled, directed graph u nodes represent objects, concepts, or situations u u labels indicate the name nodes can be instances (individual objects) or classes (generic nodes) u links u u represent relationships the relationships contain the structural information of the knowledge to be represented label indicates the type of the relationship © 2002 Franz J. Kurfess Knowledge Representation 27
Semantix Net Example Abraracourcix Astérix is-boss-of of s s is-bo is -a © 2002 Franz J. Kurfess re- Dog tak of es-c a AKO -from buys -a is s e Human liv h t i w barks-at Ordralfabetix of -to Obélix is-a a is- lls nd is-a ie th se -fr Gaul s-wi Panoramix a -a is- fight is is Cétautomatix Idéfix Knowledge Representation 28
Semantix Net Cheats u colors u should properly be encoded as separate nodes with relationships to the respective objects u font types u implies different types of relationships u again would require additional nodes and relationships u class u not relationships all dogs live with Gauls u directionality u the direction of the arrows matters, not that of the text © 2002 Franz J. Kurfess Knowledge Representation 29
Relationships u without relationships, knowledge is an unrelated collection of facts u reasoning v about these facts is not very interesting inductive reasoning is possible u relationships express structure in the collection of facts u this allows the generation of meaningful new knowledge generation of new facts v generation of new relationships v © 2002 Franz J. Kurfess Knowledge Representation 30
Types of Relationships u relationships can be arbitrarily defined by the knowledge engineer u allows great flexibility u for reasoning, the inference mechanism must know how relationships can be used to generate new knowledge v inference methods may have to be specified for every relationship u frequently used relationships u IS-A v relates an instance (individual node) to a class (generic node) u AKO v (a-kind-of) relates one class (subclass) to another class (superclass) © 2002 Franz J. Kurfess Knowledge Representation 31
Objects and Attributes u attributes provide more detailed information on nodes in a semantic network u often v expressed as properties combination of attribute and value u attributes v can be expressed as relationships e. g. has-attribute © 2002 Franz J. Kurfess Knowledge Representation 32
Implementation Questions u simple and efficient representation schemes for semantic nets u tables that list all objects and their properties u tables or linked lists for relationships u conversion u predicate into different representation methods logic nodes correspond variables or constants v links correspond to predicates v u propositional v logic nodes and links have to be translated into propositional variables and properly combined with logical connectives © 2002 Franz J. Kurfess Knowledge Representation 33
OAV-Triples u object-attribute-value u can triplets be used to characterize the knowledge in a semantic net u quickly leads to huge tables Object Attribute Value Astérix profession warrior Obélix size extra large Idéfix size petite Panoramix wisdom infinite © 2002 Franz J. Kurfess Knowledge Representation 34
Problems Semantic Nets u expressiveness u u u no internal structure of nodes relationships between multiple nodes no easy way to represent heuristic information extensions are possible, but cumbersome best suited for binary relationships u efficiency u u may result in large sets of nodes and links search may lead to combinatorial explosion v especially for queries with negative results u usability u u lack of standards for link types naming of nodes v classes, instances © 2002 Franz J. Kurfess Knowledge Representation 35
Schemata u suitable for the representation of more complex knowledge u causal relationships between a percept or action and its outcome u “deeper” knowledge than semantic networks u nodes can have an internal structure u for humans often tacit knowledge u related to the notion of records in computer science © 2002 Franz J. Kurfess Knowledge Representation 36
Concept Schema u abstraction of objects that captures general/typical properties u has the most important properties that one usually associates with an object of that type u may be dependent on task, context, background and capabilities of the user, … u similar to stereotypes u makes reasoning simpler by concentrating on the essential aspects u may still require relationship-specific inference methods © 2002 Franz J. Kurfess Knowledge Representation 37
Schema Examples u the most frequently used instances of schemata are u frames [Minsky 1975] u scripts [Schank 1977] u frames consist of a group of slots and fillers to define a stereotypical objects u scripts are time-ordered sequences of frames © 2002 Franz J. Kurfess Knowledge Representation 38
Frame u represents u provides default values for most slots u frames u related knowledge about a subject are organized hierarchically allows the use of inheritance u knowledge is usually organized according to cause and effect relationships u slots can contain all kinds of items u u rules, facts, images, video, comments, debugging info, questions, hypotheses, other frames slots can also have procedural attachments u procedures that are invoked in specific situations involving a particular slot u on creation, modification, removal of the slot value © 2002 Franz J. Kurfess Knowledge Representation 39
Simple Frame Example Slot Name Filler name Astérix height small weight low profession warrior armor helmet intelligence very high marital status presumed single © 2002 Franz J. Kurfess Knowledge Representation 40
Overview of Frame Structure u two basic elements: slots and facets (fillers, values, etc. ); u typically have parent and offspring slots u used to establish a property inheritance hierarchy (e. g. , specialization-of) u descriptive u contain declarative information or data (static knowledge) u procedural u slots attachments contain functions which can direct the reasoning process (dynamic knowledge) (e. g. , "activate a certain rule if a value exceeds a given level") u data-driven, event-driven ( bottom-up reasoning) u expectation-drive or top-down reasoning u pointers to related frames/scripts - can be used to transfer control to a more appropriate frame © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 41
Slots u each slot contains one or more facets; facets may take the following forms: u u values default v u range v u procedural attachment which specifies an action to be taken when a value in the slot is added or modified (data-driven, event-driven or bottom-up reasoning) if-needed v u what kind of information can appear in the slot if-added v u used if there is not other value present procedural attachment which triggers a procedure which goes out to get information which the slot doesn't have (expectation-driven; top-down reasoning) other v may contain frames, rules, semantic networks, or other types of knowledge © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 42
Usage of Frames u after selecting (or instantiating) a frame or script in the current context, the primary process is filling in details called for by the slots of the frame: u can inherit the value directly u can get a default value u these two are relatively inexpensive u can derive information through the attached procedures (or methods) that also take advantage of current context (slotspecific heuristics) u filling in slots also confirms that frame or script is appropriate for this particular situation © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 43
Restaurant Frame Example u Frame Example: Restaurant [Erika Rogers 1999] u provides a generic template for restaurants different types v default values v script for a typical sequence of activities at a restaurant v © 2002 Franz J. Kurfess Knowledge Representation 44
Frame Advantages u fairly intuitive for many applications u similar to human knowledge organization u suitable for causal knowledge u easier to understand than logic or rules u very flexible © 2002 Franz J. Kurfess Knowledge Representation 45
Frame Problems u it is tempting to use frames as definitions of concepts u not appropriate because there may be valid instances of a concept that do not fit the stereotype u exceptions can be used to overcome this v can get very messy u inheritance u not all properties of a class stereotype should be propagated to subclasses u alteration of slots can have unintended consequences in subclasses © 2002 Franz J. Kurfess Knowledge Representation 46
Logic u here: emphasis on knowledge representation purposes u logic and reasoning is discussed in the next chapter © 2002 Franz J. Kurfess Knowledge Representation 47
Representation, Reasoning and Logic u two parts to knowledge representation language: u syntax v describes the possible configurations that can constitute sentences u semantics determines the facts in the world to which the sentences refer v tells us what the agent believes v © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 48
Reasoning u process of constructing new configurations (sentences) from old ones u proper reasoning ensures that the new configurations represent facts that actually follow from the facts that the old configurations represent u this relationship is called entailment and can be expressed as KB |= alpha v knowledge base KB entails the sentence alpha © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 49
Inference Methods u an u u inference procedure can do one of two things: given a knowledge base KB, it can generate new sentences (alpha) that are (supposedly) entailed by KB given a knowledge base KB and another sentence alpha, it can report whether or not alpha is entailed by KB u an inference procedure that generates only entailed sentences is called sound or truth-preserving u the record of operation of a sound inference procedure is called a proof u an inference procedure is complete if it can find a proof for any sentence that is entailed © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 50
KR Languages and Programming Languages u how is a knowledge representation language different from a programming language (e. g. Java, C++)? u programming states languages can be used to express facts and u what about "there is a pit in [2, 2] or [3, 1] (but we don't know for sure)" or "there is a wumpus in some square" u programming languages are not expressive enough for situations with incomplete information u we only know some possibilities which exist © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 51
KR Languages and Natural Language u how is a knowledge representation language different from natural language u e. g. , English, Spanish, German, … u natural languages are expressive, but have evolved to meet the needs of communication, rather than representation u the meaning of a sentence depends on the sentence itself and on the context in which the sentence was spoken u e. g. , “Look!” u sharing of knowledge is done without explicit representation of the knowledge itself u ambiguous (e. g. , small dogs and cats) © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 52
Good Knowledge Representation Languages u combines the best of natural and formal languages: u expressive u concise u unambiguous u independent v of context what you say today will still be interpretable tomorrow u effective v there is an inference procedure which can act on it to make new sentences © 2002 Franz J. Kurfess [Rogers 1999] Knowledge Representation 53
Example: Representation Methods [Guinness © 2002 Franz 1995] J. Kurfess Knowledge Representation 54
© 2002 Franz J. Kurfess Knowledge Representation 55
Post-Test © 2002 Franz J. Kurfess Knowledge Representation 56
Important Concepts and Terms u u u u agent automated reasoning belief network cognitive science computer science hidden Markov model intelligence knowledge representation linguistics Lisp logic machine learning microworlds © 2002 Franz J. Kurfess u u u u natural language processing neural network predicate logic propositional logic rational agent rationality Turing test Knowledge Representation 58
Summary Chapter-Topic © 2002 Franz J. Kurfess Knowledge Representation 59
© 2002 Franz J. Kurfess Knowledge Representation 60
- Slides: 57