Knowledge Based Systems II Fall 2009 Frank Hadlock.

22
Knowledge Based Systems II Fall 2009 Frank Hadlock

Transcript of Knowledge Based Systems II Fall 2009 Frank Hadlock.

Page 1: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Knowledge Based Systems II

Fall 2009

Frank Hadlock

Page 2: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Expert SystemsGeneral problem solving has been attempted in AI but without success. Instead, systems have been developed which specialize in domain-specific knowledge such as medicine. People who work in these areas are called domain experts and solve problems by using domain-specific rules which are applied to facts or knowledge in the knowledge base. General problem classes solvable by expert systems (which replace the domain experts) are diagnostic problems (backward chaining) and design or configuration problems (forward chaining). When a path is found from a condition backward to a set of facts causing the condition (or vise versa), the path corresponds to a diagnosis (or design) and finding such a path constitutes an example of artificial intelligence

Natural Language Understanding & SemanticsTranslation from text in one natural language to another requires more than vocabulary substitution because of the inherent ambiguity of natural languages. To resolve this ambiguity requires contextual knowledge in the form of a world model. As an example, a punctuation symbol “,” can have the meaning of a list separator, or be used in place of “then”, or be used to delimit a dangling modifier. Another example is the transaltion of “hydraulic ram” in English into the Russian equivalent of “water goat”. In this last example, a world model would say that there is such an animal as a “water buffalo” but not a “water goat”. Translation usually involves syntactic analysis followed by semantic analysis and a translation path from source to target constitutes an example of artificial intelligence

Page 3: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Modeling Human PerformanceMuch of artificial intelligence is concerned with duplicating or surpassing human ingenuity on the computer with no concern with how humans perform. Cognitive modeling is concerned with using computers to determine human performance. Computer based tutoring is an example which has been applied to tutoring algebra students to solve word problems. Cognitive modeling systems such as ACT model human performance with rules or productions. The tutor interacts with the student by posing a problem and then posing questions, attempting to guide the student to a correct solution.

By examining the responses, the tutor either poses another question corresponding to a correct step in the solution, or diagnoses an incorrect “buggy” rule being used by the student. In this case, the tutor reverts back to a previous concept needed in the correct solution. A path from problem statement to any intermediate state constitutes an example of artificial intelligence

Planning and RoboticsDiscussion of planning and robotics here is confined to motion planning in two dimensions. A basic assumption in this discussion is that the Euclidean coordinates are available for the position of the robot, of obstacles, and of goals. Motion planning is accomplished by working with the state space of positions where positions are connected by an edge if there is no intervening obstacle. A path from initial position to a goal position is a solution to the problem of motion planning that constitutes an example of artificial intelligence.

Page 4: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Cognitive AlgebraTutors• Algebra class may be less difficult and a bit more fun these days, thanks to research on how human cognition works.

Developed over two decades by psychologist John Anderson, the Adaptive Character of Thought (ACT-R) theory is a framework for understanding how we think about and attack problems, including math equations. The theory reflects our understanding o human cognition based on numerous facts derived from psychological experiments.

• ACT-R suggests that complex cognition arises from an interaction of procedural and declarative knowledge. Declarative knowledge is a fairly direct encoding of facts (such as Washington, DC is the capital of the United States, 5 + 3 =8); procedural knowledge is a fairly direct encoding of how we do things (such how to drive or how to perform addition). According to the ACT-R theory, the power of human cognition depends on how people combine these two types of knowledge.

• Significance• The ACT-R theory provides insights into how students learn new skills and concepts, and, in doing so allows teachers to see

where students may need extra practice to master the new work.• Practical Application • Dr. Anderson and colleagues at Carnegie Mellon University have used this research to develop cognitive tutors, computer-

tutoring programs that incorporate the ACT-R theory in the teaching of algebra, geometry and integrated math. The tutors are based on cognitive models that take the form of computer simulations that are capable of solving the types of problems that students are asked to solve. The tutors incorporate the declarative and procedural knowledge imbedded in the instruction and monitor students’ problem solving to determine what the students know and don’t know. This allows instruction to be directed at what still needs to be mastered and helps insure that students’ learning time is spent in a more efficient manner. Students work on a concept until it is fully understood. Students who are having conceptual problems will be drilled on in that area, while those who have mastered the concept move on to other areas.

• The most widely used cognitive tutor program – now known as Carnegie Learning’s Cognitive Tutor - combines software-based, individualized computer lessons with collaborative, real-world problem-solving activities. The program now serves more than 150,000 students in most of the nation’s largest school districts. Field studies have shown dramatic student achievement gains where the program is in use.

• In 2003, the U.S. Department of Defense Schools awarded a contract that will use Cognitive Tutor mathematics curricula in its 224 public schools in 21 districts located in 14 foreign countries, seven states, Guam and Puerto Rico. These schools have approximately 8,800 teachers serving 106,000 students.

• Cited Research• Anderson, J. R. (1983). The architecture of cognition. Cambridge: MA: Harvard University Press.• Anderson, J. R. (1993). Rules of the Mind. Hillsdale, NJ: Erlbaum.

Page 5: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Lisp Lisp is the first language used in Artificial Intelligence and is structured so that a list is either data or a

function call. In the case of a function call, Lisp uses prefix notation which means that the first list item is the name of the function and the remaining items are the arguments. Lisp indicates variables by a question mark. To illustrate

– (forall ?x

(implies (cs_student ?x) (must_take ?x data_structures) ) )– (cs_student bill)

Would yield– (must_take bill data_structures)

PrologProlog is a logic programming language based on predicate logic. Prolog uses capital letters for variables and lowercase letters for predicates and constants and reverses the order for implication. Instead of writing P Q, Prolog orders implication as Q :- P. A comma is used to separate arguments and for conjunction with a period marking the end of a sentence. To illustrate,

– cs_student(bill).– must_take(data_structures, X ) :- cs_student(X)

The first sentence asserts a fact that “bill” is a cs_student while the second sentence asserts that any cs_student must take data structures. Prolog is launched by a goal such as

– :- must_take(data_structures,Y) which would return– must_take(data_structures , bill)

Page 6: Knowledge Based Systems II Fall 2009 Frank Hadlock.

CLIPS

Clips organizes knowledge by using named fact templates

consisting of named slots. An example is the PAY template

with slots for hours and pay rate. The deffacts statement

creates initial facts accolrding to selected templates. An

example is the payroll statement which assigns an initial fact

of 44 hours and of a rate of $8 / hour.

Fact List(deftemplate pay (slot hours)(slot rate))

(deffacts payroll ( pay (hours 44)(rate 8)) (status incomplete))

Page 7: Knowledge Based Systems II Fall 2009 Frank Hadlock.

CLIPS

Clips infers new knowledge by using named rule templates

consisting of an antecedent which must match facts in the

fact list and a consequent which adds or modifies facts.

Fact List

Rule List(defrule calculate_basic

?p <- (pay (hours ?h)(rate ?r)) (test (<= ?h 40))

=> (assert (basic_pay (* ?h ?r)))

(retract ?p))

Page 8: Knowledge Based Systems II Fall 2009 Frank Hadlock.

CLIPS

Rule List

Rule List(defrule calculate_basic

?p <- (pay (hours ?h)(rate ?r)) (test (<= ?h 40))

=> (assert (basic_pay (* ?h ?r)))

(retract ?p))

(defrule calculate_overtime (pay (hours ?h)(rate ?r))

(test (> ?h 40)) (status incomplete)

=> (assert (overtime (* (- ?h 40) (* ?r 1.5))))

) (defrule calculate_regular

(pay (hours ?h)(rate ?r)) (status incomplete)

(test (> ?h 40)) =>

(assert (regular (* 40 ?r) )))

(defrule calculate_adjustedgross (regular ?r)

(overtime ?o) (status incomplete)

=> (assert (adjusted_gross (+ ?r ?o)))

(assert (status done)))

(deftemplate pay (slot hours)(slot rate))

(deffacts payroll ( pay (hours 44)(rate 8)) (status incomplete))

Page 9: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Neural Nets An artificial neuron consists of inputs x i , I = 1..n, which have a value of 0 or 1. Each input x i can collect a value from the environment or from the output of another neuron and an associated weight wi.

A neuron is activated if the sum of the weighted inputs w ixi exceeds a threshold function f. The neuron outputs a 1 if activated and otherwise outputs a 0. Two sets of points in 2 dimensional space are linearly separable if they can be separated by a straight line. In this case, the points can be classified by a single neuron which outputs a 0 for points on one side of the line and a 1 for points on the other side. This classification is an example of artificial intelligence. The point sets classified by a logical Or gate and those classified by a logical And gate are linearly separable but not those classified by an Exclusive Or.

Genetic AlgorithmsGenetic algorithms are based on a biological metaphor of evolving solutions to a problem. The solutions are strings over some alphabet and are referred to as genes. Given an initial population P0, each member gene is evaluated by a fitness function specific to the problem For example, for the knapsack function, the gene might be a list of object indices to be included and the fitness might be the wasted space in the knapsack. Members are selected based on fitness and offspring are created using crossover and mutation operators to form the next population. The process halts after so many populations and the most fit member of the final population is selected as the solution to the problem

Page 10: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Representation and Search

• Representation of Problem Information– Propositional & Predicate Logic– Semantic networks– State Space

• set of problem states along with • transitions between states • and a set of start states and goal states. • a path from start to goal is a solution

• Search– Techniques for finding a solution

Page 11: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Eight Puzzle

• Representation – The squares of the eight puzzle can be represented by integers 1 .. 8 and 9 represents empty square.

• A state of the puzzle is a permutation of 1..9 where 1st three represent top row, 2nd three represent middle row, and 3rd three represent bottom row.

Page 12: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Eight puzzle transitions

• An eight puzzle transition consists of moving a square numbered 1..8 into the adjacent vacant square which can only be done if it is adjacent to the numbered square.

• Representation of a board configuration is a permutation of 1..9 where 9 represents vacant square. Example – 132496758 represents 1st row 132, 2nd row 4 blnk 6, 3rd row 748.

• Since the blank is in the middle position, 3 can be moved down, or 4 to the right, or 6 to the left, or 5 moved up.

• These transitions make 132496758 have neighbors 192436758, 132946758, 132469758, and 132456798.

Page 13: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Knowledge Representation

• Essential to artificial intelligence are methods of representing knowledge. Besides propositional and predicate logic, a number of other methods have been developed, including:– Semantic Networks– Conceptual Dependencies– Scripts– Frames

Page 14: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Semantic Networks

• Models meaning of language:– Nodes correspond to word concepts– Arcs are labeled with a property name or

relationship and link a node (word concept) with another (value of property).

• Quillian (1967) introduced semantic networks while others (Simmons -1973, Brachman-1979, Schank-1979) have extended the model.

Page 15: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Semantic NetworksStandardization of Relationships

• Standardization of relationships for representing knowledge expressed in language

• focuses on case relations between verbs and nouns in sentence (Fillmore ’68, Simmons ’73)

• Prepositions or articles indicate relationship between verb and noun :– Agent : entity performing the action– Object : entity acted upon– Instrument : entity used in performing the action – Etc.

Page 16: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Conceptual DependenciesSet of Primitive Actions

• Standardization of relations led to axiomatic approach to build semantic model for representing meaning of language

Four Primitive Concept ClassesACTS - Actions PPs – Objects

(Picture producers)AAs – Modifiers of actions (Action Aiders)

PAs – Modifiers of objects (picture aiders)

Each Action is assumed to reduce to one or more of the primitive ACTs

ATRANS – transfer relationship (give)

PTRANS – transfer physical location (go)

PROPEL

MOVE

GRASP

INGEST

EXPEL

MTRANS

MBUILD

CONC

SPEAK

ATTEND

Page 17: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Building Complex Conceptual Dependencies

ConceptualDependency

Semantics Example

PP ACT An actor acts John PTRANS … John ran

PP PA Object has attribute John height John is tall

ACT O PP Indicates object of action John Propel O cartJohn pushes the cart

ACT R PP PP

Indicates the receipt And donor of

An Action

John ATRANS R John Mary

John took the book from Mary

Page 18: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Scripts

• Scripts formalize stereotyped sequences of events.• A script for a restaurant differs from one for a “fast food” model.

• The components of a script are– Entry conditions which must be true for script to be activated– Termination conditions which are true when script is terminated.– Props or object which support the script. The script for a restaurant would

include table and cash register props.– Roles are the actions that individual participants must perform. The waiter takes

orders, the customer eats and pays bill.– Scenes break the script into subsequences which

• Are sequential in occurerence

• Provide alternatives (if condition A then Scene1 elsce Scene2)

Page 19: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Frames• Frames formalize stereotyped entities and actions.• Frames have labeled slots with slot contents an object or action and

slot labels are the role played by the slot filler in relation to the central entity of action.

• A frame is like a record that contains information relevant to stereotyped action or entity:– Frame Identification

– Relationship to other frames (part-of, caused-by)

– Slots• Label indicating relationship to central slot• Requirements for slot filler• Procedural information to construct or manipulate slot contents• Default Contents• Slot contents

Page 20: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Frame Examples

Case Frame representation of

“Mary fixed the chair with glue”

Action Fix

Agent Mary

Object Chair

Instrument Glue

Time past

Page 21: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Conceptual GraphsA Network Language

• A conceptual graph is a refinement of semantic networks.

• A conceptual graph is bipartite with one class of nodes representing word concepts and the other class of nodes representing relations.

• Arcs go from concept class nodes to relation class nodes and vise vesa.

Page 22: Knowledge Based Systems II Fall 2009 Frank Hadlock.

Conceptual Graph ExamplesFlies is unary relation or predicate

Color is a binary relation

Parents is a ternary relation

Mary gave john a book

bird flies

dog color brown

child parents

mother

father

mary agent give object book

recipient john