Presentation on theme: "FT228/4 Knowledge Based Decision Support Systems"— Presentation transcript:
1 FT228/4 Knowledge Based Decision Support Systems Frame-Based Expert SystemsHave been talking so far about expert systems that represent knowledge as rulesHave talked about general production rules but also about how to handle uncertainty because it may not always be possible to represent full knowledge as a set of rulesGoing to now look at another representation technique called framesYou may recognise some things talked about from JESSRef: Artificial Intelligence A Guide to Intelligent Systems, Michael Negnevitsky – Aungier St. Call No
2 Knowledge Representation In building a knowledge base, the programmer must select the significant objects and relations in the domain and map these into formal languageThe resulting program must contain sufficient knowledge to solve the problem of the domain, it must make correct inferences and it must do so quicklyWe can consider a knowledge base as a mapping between objects and relations in a problem domain and the computational objects and relations in a programThe results of inferences on the knowledge base should correspond to the results of actions or observations in the worldThe computational objects, relations and inferences are determined by the knowledge representation language the programmer selects.
3 Knowledge Representation General principles and issuesClass hierarchies are found in both scientific and common sense classification schemesHow do we provide a general mechanism for representing them?How may we represent definitions?How may we represent exceptions?When should a knowledge based system make default assumptions about missing information, and how should it adjust its reasoning if these assumptions prove wrong?How may we best represent time?How may we best represent causality?How may we best represent uncertainty?
4 Knowledge Representation Medium of representation is the languageScheme is how we use the languageClassification of schemesLogical representation schemes: Use expressions in formal logic to represent a knowledge base. Inference rules and proof procedures apply this knowledge to problem instancesProcedural representation schemes: Knowledge represented as a set of instructions for solving a problem. In a rule based system, an if…then may be seen as a procedure for solving a goal in a problem domain, by solving the premises in order.
5 Knowledge Representation Classification of schemes (contd.)Network representation schemes: Network representations capture knowledge as a graph in which the nodes represent objects or concepts in the problem domain and the arcs represent relations or associations between themStructured representation schemes: Extension of networks by allowing each node to be a complex data structures consisting of slots with attached values. These values may be simple numeric or symbolic data, pointers to other frames or even procedures for performing a particular task.
6 Issues in Knowledge Representation Most of the issues in knowledge representation are motivated by the effort to program a computer to understand natural languages such as English.Issues raised:Exactly what things can be represented by the objects and relations in the language. E.g. if a predicate relates an object to a value, such as hascolour(car,red) how can that be used to represent “John’s car is redder than Mary’s”.What level of complexity is required for our objects.How do we distinguish between intensional and extensional knowledge? The intension determines what a concept means at an abstract level (ball is round). The extension is the set of all things denoted by the object (set of all balls).A database denotes the extension of the object, whereas an expert system includes the intension of the object.
7 Issues in Knowledge Representation Issues raised (contd.):How do we represent meta-knowledge, or knowledge about the objects and structures of the representation language itself? This type of knowledge helps us represent things such as “George believes thaty Tom knows that Mary’s car is red”How do we represent into class hierarchies, use inheritance, excpetions, overriding, overloading, default values etc.
8 Frames“Thinking always begins with suggestive but imperfect plans and images; these are progressively replaced by better–but usually still imperfect–ideas”
9 What is a frame ?Minsky 1975 : “When one encounters a new situation (or makes a substantial change in one’s view of a problem) one selects from memory a structure called a ‘frame’. This is a remembered framework to be adapted to fit reality by changing details as necessary”Basically what we are talking about is yet another model of human cognition: the structure of knowledge in memory. Have to keep in mind constantly what we are trying to do with expert systems. We are trying to acquire and represent the knowledge used by experts and the act on it in a way that mimics an expert.Basically the idea is that we adjust to new experiences or situations by calling up information structured from past experiences. When then specifically fashion or revise the details from these past experiences to represent individual differences in the new situation.
10 What is a frame ?Complex unit that represent situations or objects in our domain of interestData structure with typical knowledge about a particular object or conceptProposed by Marvin Minsky in 1970sUsed to capture and represent knowledge in frame-based expert systems
11 Example John kicked the ball John Person Male 6’4” Ball Round White Black spots
12 Frame Examples Quantas Boarding Pass Carrier: Quantas Name: Mr. Black Flight: Q 101Date: 12 DecSeat: 24AFrom: MelbourneTo: SydneyBoarding: 0600Gate: 4Air New Zealand Boarding PassCarrier: Air New ZealandName: Mr. WhiteFlight: NZ 101Date: 13 DecSeat: 25AFrom: MelbourneTo: ChristchurchBoarding: 1800Gate: 7Think of them as templates – each frame has its own name and a set of attributes or slots associated with it.So we have slots above.Slots may have a procedure to determine the value
13 Frames Has a name A set of attributes or slots associated with it E.g. Frame Boarding Pass has attributes Carrier, Name, Flight, Date,Seat,From, To, Boarding,GateEach slot has a value associated with itSlot may have a procedure associated with it to determine its valueSlot may be a pointer to another frame or set of rulesMay recognise this from jess – often used in conjunction with production rulesBasically frame is a way of organising knowledge to describe various attributes/characteristics of an objectAn application of object-oriented programming for expert systems to an extentObject is a concept – abstraction or a things with a crisp boundary or meaning for the problem at handObjects have an identity and are clearly distinguishableThink of our example of lab exercise patient, doctor, disease, symptomObject can combine both data and behaviour into a single entity – contrast with rule based expert systems where facts and rules are separated.Basically a frame is an object.Talking about using frames to represent well-understood stereotypical situations
14 FramesRule Based systems may work with facts scattered through the knowledge baseMay have to search through knowledge that is not relevantSearch may be slowFrames better organise the knowledge in the knowledge base
15 Slots Frame is a collection of slots. May include information such as Frame nameRelationship of frame to other framesE.g. frame DELL Laptop may be member of class Computer which may belong to class HardwareSlot ValueCan be symbolic, numeric or Boolean. Can be assigned when the frame is created or during an expert system sessionDefault Slot ValueTaken to be true when no evidence to contrary is found.Range of Slot ValueDetermines where a particular object or concept complies with the stereotype requirementsProcedural InformationProcedure executed when the slot is changed or neededSlot Value: in our boarding pass example slot name had symbolic values, slot gate had numeric valuePresence, absence or amount of detail in each of these depends on the particular problem-solving situation addressed
16 FacetsA facet is a means of providing extended knowledge about an attribute of a frameUsed to establish the attribute value, control end-user queries and tell the inference engine how to process the attributeValue facetSpecify default and initial valuesPrompt facetEnable the end-user to enter the attribute onlineInference facetAllow us to stop the inference process when a value of a specified attribute changesWhat is the correct level of decomposition ? What is a frame, what is a slot, what is a facet ?There is no correct level. Depends on the nature of the problem and the judgement of the knowledge engineer.Work through an example – Lab4 exercise.
17 Classes and InstancesFrame may refer to a particular object or a group of similar objectsClass-frame describes a group of objects with common attributesInstance-frame refers to a particular instance of an objectEach frame ‘knows’ its classImplicit property of the frame
18 Class and Instance Example CLASS: Boarding PassCarrier: [Str]Name: [Str]Flight: [Str]Date: [Str]Seat: [Str]From: [Str]To: [Str]Boarding: [Num]Gate: [Num]INSTANCE: Air New Zealand Boarding PassCarrier: Air New ZealandName: Mr. WhiteFlight: NZ 101Date: 13 DecSeat: 25AFrom: MelbourneTo: ChristchurchBoarding: 1800Gate: 7INSTANCE: Quantas Boarding PassCarrier: QuantasName: Mr. BlackFlight: Q 101Date: 12 DecSeat: 24AFrom: MelbourneTo: SydneyBoarding: 0600Gate: 4In other words a frames class is an implicit property of the frame For example instances identify their class in a slot ClassFrames basically make it easier for us to organise our knowledge hierarchicallyAlso allows us to think of an object as a single entity and ignore the details of the internal structurei.e. don’t care about the mechanical organisation of a car until it breaks down we just use it – then want to know the details.Why bother with classes ?We are less concerned with defining strictly and exhaustively all the properties of an object we are more concerned with the salient properties typical for the entire class.Based on the idea that humans seem to be more concerned with salient properties – idea of proto-typesPrototypical bird can fly so we tend to think of this as a property of a bird even though there are birds that can’t fly. There is also the sense that for example an eagle is a better example of the bird category than the penguin because it is more typical of its class. Nonetheless the existence of the penguin means that we are forced to qualify generalisation such that birds can fly
19 Class InheritanceAttributes of a class-frame represent things that are typically true for all objects in the classSlots and default values of a class frame are inherited across the class/sub-class and class/member hierarchy.Slots in instance-frames can be filled with actual data uniquely specified for each instanceDefault values are only assigned to selected slots to be used only if other information is not availableWhen an instance of a frame is created the system will attempt to fill its slots either by querying the user, accepting the default from the class frame or executing some procedure to obtain the instance value.The inheritance of default values can mean that the data description of the problem is incorrect, lets us make incorrect assumptions and can lead to incorrect conclusions
20 Relationships among classes Subclass is related to its superclass by an ‘is-a’ relationAn instance-frame can overwrite some of the typical attribute values in the hierarchyThe instance-frame remains a member of the class with access to properties further up the hierarchy even if it violates the typical value in its classRelationships in such a hierarchy constitute a process of specialisationFrame at the top of the hierarchy represents some generic concept, frames further down represent more restricted concepts
21 Relationships among objects Generalisation denotes ‘a-kind-of’ or ‘is-a’ relationship.E.g. car is a vehicle, boat is a vehicleAggregation denotes a ‘part-of’ or ‘part-whole’ relationship in which subclasses representing components are associated with a superclass representing a whole.E.g. an engine is part of a carAssociation describes some semantic relationship between different classes unrelated otherwise. Usually appear as verbs and are bi-directional.E.g. Mr. Black owns a house, Mr. Black owns a car, John kicked a ballBi-directional : does not imply that the verb is the same in both directions. The house does not own Mr. Black it is owned by or belongs to. Can use the inverse of the relationship.
22 More about inheritance Inheritance is the process by which all characteristics of a class-frame are assumed by an instance frame.Instance-frame inherits from its parent-frame.Can have multiple inheritanceAll parents must have unique attribute namesMeans code reuseReduces number of independent and specific features of an expert systemHave already said that a common use is to impose default values on all instance-frames.Can view as a tree-like structure that is turned over. Highest level of abstraction is at the top I.e. root. Branches illustrate lower levels of abstraction, leaves at the bottom are instance frames. Each frame inherits characteristics from those higher in the hierarchy.Multiple inheritance : job of the knowledge engineer is to group similar classes together and reuse common code.
23 DisadvantagesCannot distinguish between essential properties and accidental propertiesMay become impossible to construct composite concepts when using multiple inheritanceLeave the knowledge engineer with difficult decisions to make about the hierarchical structure of the systems and its inheritance pathsAll seems very simple – what is the catchSimplicity has been lost at implementation stageEssential property – property frame must have to be considered member of its classAccidental property – properties instances just happen to haveInstances inherit all typical properties and because it is possible to overwrite them anywhere in the frame hierarchy it may become impossible to construct composite concepts when using multiple inheritanceAppeals to so-called typical properties do not always work so we get unexpected resultsFrame-based expert systems cannot offer safeguards against creating coherent structures but do provide data and control structures that are more suited for simulation of human reasoning than conventional programming languages – also combine two approaches to knowledge representation, rules and frames
24 Methods and DemonsA method is a procedure associated with a frame attribute that is executed whenever requestedMethod can determine an attributes specific value or execute a series of actions when the value changesA demon generally has an IF-THEN structureExecuted when attribute in IF statement changesTwo types of methodWHEN CHANGEDExecuted immediately when an attribute value changesWHEN NEEDEDUsed to obtain attribute value only when neededExpert systems are not only required to store information but also to validate and manipulate it.To add actions to frames need methods and demonsMethod – equivalent to series of commands in a macroWhen needed - Executed when information associated with attribute value is needed for soling the problem but attribute value is undeterminedDemon – executed when attribute in IF changes. Often used as synonym for method but demon is limited to IF then structure. Methods used for more complex procedures.
25 Interaction of Rules and Frames – Inference Engine Rule-Based Expert SystemInference engine links rules in knowledge base with data in databaseWhen goal is set up, inference engine searches knowledge base to find rule with that goal in its consequentIf it finds such a rule and if part matches data in database, rule is fired and goal obtains its value.If no such rule found , the queries user for valueMost frame based expert systems allow use of a set of rules to evaluate information contained in frames
26 Inference Engine Frame-Based System Inference engine also searches for goalRules play auxiliary role. Frames represent major source of knowledge.Methods and demons used to add actions to frames.Goal can be established either in method or demon.
27 Inference engine Frame-based system Based on goal, inference engine finds rules whose consequents find goal of interestExamines these rules one at a time in order they appear in the rule baseExamines the validity of each antecedent in the first ruleThis may require theIf all antecedents are valid, concludes the goalIf any of the antecedents are invalid, concludes goal is invalid and will proceed to next rule
28 Inference engineHas to obtain value from WHEN NEEDED method only when it has not been determined from rule baseSearch order for attribute value has to be determined firstAttach a SEARCH ORDER facet to an attribute to indicate where and in what order to obtain attribute valueE.g. set the order so that it first searches the rule base and only when this fails executes when needed
29 Rule-Based Expert Systems Set of rules represents the domain knowledge useful for problem solving.Each rule captures some heuristic of the problem.Each rule adds some new knowledge and thus makes the system smarter.Rule base can be easily modified by changing, adding and subtracting rules.Principal difference is how the knowledge is viewed and represented in the system.
30 Frame-based Expert Systems Overall hierarchical structure of knowledge is decided first.Classes and attributes are identified.Hierarchical relationship between frames are established.Architecture allows us to add actions to the frames through methods and demons.Problem is viewed in a different manner
31 Building Frame-based Expert System Specify the problem and define the scope of the systemDetermine the classes and their attributesDefine instances.Design displays.Define WHEN CHANGED and WHEN NEEDED methods, and demons.Define rules.Evaluate and expand the system.Basic steps are the same as when developing rule-based expert systemsKnowledge engineer has to obtain general understanding of problem and overall knowledge structureThey then decide on the tool to use to develop the prototype systemThey then create the knowledge base and test it by running a number of consultationsExpert system is then expanded, tested and revised until it does what the user wants