300 likes | 604 Views
Knowledge Representation. KR encompasses: The structure used to describe elements of Knowledge The interpretive process required to use the described knowledge Components: Factual Knowledge (Facts) Procedural Knowledge (Rules). Representation Evaluation.
E N D
Knowledge Representation KR encompasses: • The structure used to describe elements of Knowledge • The interpretive process required to use the described knowledge Components: • Factual Knowledge (Facts) • Procedural Knowledge (Rules)
Representation Evaluation Transparency: Easy identification of knowledge Explicitness: Direct representation Naturalness: Represent without transformation Efficiency: easy access of knowledge Adequacy: Complete knowledge representation Modularity: Fragmentations-independent storage
Level of Representation • Low Level Knowledge The fundamental knowledge used to derive further knowledge Example: The law of Gravity (also known as first principle knowledge) • High Level Knowledge The derived knowledge from the first principle knowledge. This uses inferencing methods
Formal Logic • The most widely used formal logic method is FIRST-ORDER PREDICATE LOGIC Components : Alphabets Formal language Axioms Inference Rules
Alphabets-I Predicates, variables, functions,constants, connectives, quantifiers, and delimiters Constants: (all capital letters) BLUE a color SANTRO a car CROW a bird Variables: (all lower case letters) dog an element that is a dog, but unspecified color an unspecified color
Alphabets-II Function: father(ALI) A function that specifies the unique element, that is the father of ALI killer(x) x is a killer Predicate MAN(SHAHID) A predicate which gets TRUTH value equal to 1 (or represented by T) when the interpretation is true. Here Shahid is a man so the predicate is true. BIGGER(ALI,father(BABAR)) Ali is bigger than the father of Babar.
Alphabets-III Connectives: ^ and v or ~ not Implication Quantification Universal quantifiers Existential quantifiers
Examples My house is a blue, two-story, with red shutters on the corners BLUE(MY-HOUSE)^TWO-STORY(MY-HOUSE)^RED-SHUTTERS(MY-HOUSE)^CORNER(MY-HOUSE) Ali bought a scooter or a car BOUGHT(ALI,CAR)vBOUGHT(ALI,SCOOTER) IF fuel, air and spark are present the fuel will combust PRESENT(SPARK)^PRESENT(FUEL)^PRESEN(AIR) COMBUSTION(FUEL)
Examples All people need air Vx[PERSON(x) NEED_AIR(x)] The owner of the car also owns the boat [OWNER(x,CAR)^OWNER(x,BOAT)] Formulate the following expression in the PC: “Ali is a computer science student but not a pilot or a football player”
Examples Restate the sentence in the following way: • Ali is a computer science (CS) student • Ali is not a pilot • Ali is not a football player CS_STUDENT(ALI)^ ~PILOT(ALI)^ ~FOOTBALL_PLAYER(ALI)
Examples Studying expert systems is exciting and applying logic is very fun if you are not going to spend all of your time slaving over the terminal Vx(~SLAVE(x) [ES_ECITING(x)^LOGIC_FUN(x)]) Every voter either favors the amendment or despises it Vx[VOTER(x) [FAVOR(x,AMENDMENT) v DESPISE(x,AMENDMENT)] ^ ~[FAVOR(x,AMENDMENT) v DESPISE(x,AMENDMENT)[)]
Non-formal Methods Rule Based Method A rule based system consists of a set of IF-THEN rules, a set of facts normally representing things that are currently held to be true, and some interpreter controlling the application of the rules, given the facts Control Scheme Rules IF ------ THEN ADD -------- IF ----- AND ----- THEN ADD ----- Database of facts Initial facts
Reasoning Methods Forward Chaining Method Data Driven: Starts from the initial facts and adds new conclusions to the facts database and tries to reach the conclusions Backward Chaining Method Goal Driven: Starts from the goal and looks for the premise of the conclusion in the database, followed by redefining the goal and so on.
Forward Chaining Method Algorithm Repeat: • Find all the rules which have conditions (IF part) satisfied • Select one, using conflict resolution strategies (which rule to be selected first if there more than one satisfy the conditions). • Perform actions in conclusions, possibly modifying current working memory (database of facts).
Forward Chaining Method Facts: F1:alarm_beeps F2:hot Rules: R1: IF hot AND smoky THEN ADD fire R2:IF alarm_beeps THEN ADD smoky R3: IF fire THEN ADD switch_on_sprinklers
Conflict Resolution • Prefer rules that involve facts that have been recently added to the working memory • Prefer rules with more specific facts • Allow user to prioritise the rules
Forward Chaining Method Facts: F1:alarm_beeps F2:hot F3:dry Rules: R1: IF hot AND smoky THEN ADD fire R2:IF alarm_beeps THEN ADD smoky R3: IF fire THEN ADD switch_on_sprinklers R4: IF dry THEN ADD switch_on_humidifiers R5: IF sprinklers_on THEN DELETE dry R6: IF hot THEN ADD summer
Backward Chaining Method Algorithm To prove a goal: • If G is in the initial facts it is proven • Otherwise, find a rule which can be used to conclude G, and try to prove each of that rule’s pre-conditions. G is then proved true if all the pre-conditions are proved true.
Backward Chaining Method G: switch on the sprinklers Facts: F1:alarm_beeps F2:hot Rules: R1: IF hot AND smoky THEN ADD fire R2:IF alarm_beeps THEN ADD smoky R3: IF fire THEN ADD switch_on_sprinklers
Backward Chaining Method Let G=G1: switch on the sprinklers Matches conclusion of R4, precondition of R4 have to be satisfied and becomes new goal New Goal G2: fire Matches conclusion of R1, precondition of R1 have to be satisfied and becomes new goal New Goals G3:smoky, G4: hot G3 Matches conclusion of R2, thus new goal is alarm beeps G4 is already in the initial facts so is true New Goal is G5: alarm_beeps, G4: hot Both are included in the initial facts thus the initial Goal G is true
Example Facts: Nil Rules: R1: IF coughing THEN ADD smoky R2: IF wet AND NOT raining THEN ADD burst_pipe R3: IF NOT coughing AND alarm_rings THEN ADD burglar R4: IF smoky AND hot THEN ADD fire Specify the Line of Questioning and implement backward chaining method to prove burglary
Example Interaction between the user and the ES: System: Are you coughing?. User: No. System: Are you getting wet?. User: No. System: Is there an alarm ringing?. User: No.
Example-II Suppose we are trying to develop a safety system for the a chemical plant. If some liquids spills over and if it is flammable the situation is dangerous and the fire department should be called. In order to check that what type of liquid is spilled one should check the smell of the liquid and the pH value of the material. If the smell is like vinegar and the pH is less than 6, the material is definitely acetic acid. Specify the Line of Questioning and implement backward chaining method to prove material being acetic acid and should the fire deaprtment be called or not
Rules R1: If a flammable liquid was spilled, then call the fre department R2: If the pH of the spill is less than 6, then the spill material is an acid R3: If the spill material is an acid, and the spill smells like vinegar, then the spill material is acetic acid Ph less than 6 Material acid Acetic Acid Smell like vinegar