reasoning systems reasoning systems
play

Reasoning Systems Reasoning Systems Chapter 4 Chapter 4 Dr Ahmed - PowerPoint PPT Presentation

Reasoning Systems Reasoning Systems Chapter 4 Chapter 4 Dr Ahmed Rafea Rafea Dr Ahmed Introduction Introduction In this chapter we will explore how the various In this chapter we will explore how the various knowledge


  1. Reasoning Systems Reasoning Systems Chapter 4 Chapter 4 Dr Ahmed Rafea Rafea Dr Ahmed

  2. Introduction Introduction � In this chapter we will explore how the various In this chapter we will explore how the various � knowledge representations can be used for knowledge representations can be used for reasoning reasoning � We will explore : We will explore : � � Reasoning with rules Reasoning with rules � � Forward chaining Forward chaining � � Backward chaining Backward chaining � � Fuzzy rule systems Fuzzy rule systems �

  3. Reasoning with Rules- -1 1 Reasoning with Rules � If If- -then rules became the most popular form of declarative then rules became the most popular form of declarative knowledge representation used in AI applications knowledge representation used in AI applications � A knowledge A knowledge- -based system is the common term to describe a rule based system is the common term to describe a rule- - based processing system. It consists of three major elements: a based processing system. It consists of three major elements: a knowledge base, a working memory (database), and an inference knowledge base, a working memory (database), and an inference engine, which contains the reasoning logic used to process the rules ules engine, which contains the reasoning logic used to process the r or data or data � Given the following rule: Given the following rule: � If num_wheels = 4 and motor = yes If num_wheels = 4 and motor = yes then vehicleTypt = automobile then vehicleTypt = automobile � This rule has two antecedent clause joined by a conjunction (If This rule has two antecedent clause joined by a conjunction (If num_wheels = 4 and motor = yes ) and a single consequent clause num_wheels = 4 and motor = yes ) and a single consequent clause (then vehicleType = automobile). The rule states a relationship p (then vehicleType = automobile). The rule states a relationshi between clauses and depending on the situation, we can generate between clauses and depending on the situation, we can generate new information or prove the truth of the assertion. new information or prove the truth of the assertion. � For example, if we know that the a vehicle has 4 wheels and a mo For example, if we know that the a vehicle has 4 wheels and a motor, tor, we can conclude that the vehicleType is an automobile and add th we can conclude that the vehicleType is an automobile and add that at fact to our knowledge base. fact to our knowledge base.

  4. Reasoning with Rules- -2 2 Reasoning with Rules � A rule whose antecedent clauses are all true is said to be trigg A rule whose antecedent clauses are all true is said to be triggered ered or ready to fire. We fire a rule by asserting the consequent clause use or ready to fire. We fire a rule by asserting the consequent cla and adding it as a fact to our working memory and adding it as a fact to our working memory � Most rule Most rule- -based systems allow rules to have labels or names such based systems allow rules to have labels or names such as Rule1: or Automobile: as Rule1: or Automobile: � For example: For example: � Rule1: If Rule1: If num_wheels num_wheels = 4 and motor = yes = 4 and motor = yes then vehicleTypt vehicleTypt = automobile = automobile then � Another enhancement to rule syntax is the addition of a certaint Another enhancement to rule syntax is the addition of a certainty y factor. This enables us to have a large knowledge base because factor. This enables us to have a large knowledge base because we cant write rules that applied 100% of the time with 100% we cant write rules that applied 100% of the time with 100% confidence. For example: confidence. For example: � Rule1: if ( Rule1: if (weather_forecast weather_forecast = rain) and ( = rain) and (weather_probability weather_probability > 80%) > 80%) Then (chance_of_rain chance_of_rain = high) with CF:90 = high) with CF:90 Then (

  5. Reasoning with Rules- -3 3 Reasoning with Rules � Many rule Many rule- -based systems allow functions to be called from the based systems allow functions to be called from the antecedent clauses. These functions are called sensors. When antecedent clauses. These functions are called sensors. When functions are allowed in the consequent, they are called effectors rs functions are allowed in the consequent, they are called effecto � Rule:2 if Rule:2 if sensor(mailArrived sensor(mailArrived) then ) then affector(processMail affector(processMail) ) � The main problem in rule The main problem in rule- -based systems is as the number of based systems is as the number of rules grows, the if- -then rules lose their effectiveness from a then rules lose their effectiveness from a rules grows, the if readability perspective . Also as more complex information readability perspective . Also as more complex information comes in, or as things change in the real world, rules that may comes in, or as things change in the real world, rules that may have been true before become false. have been true before become false. � The problem of dealing with changes is called non The problem of dealing with changes is called non- -monotonic monotonic reasoning reasoning � Most reasoning systems, such as predicate logic, are monotonic, Most reasoning systems, such as predicate logic, are monotonic, they add information but do not retract information from the they add information but do not retract information from the knowledge base knowledge base

  6. Reasoning with Rules- -4 4 Reasoning with Rules This is a an example for a rule This is a an example for a rule-base system. It include nine rules base system. It include nine rules � Vehicle Rule Base: Vehicle Rule Base: Bicycle: if Bicycle: if vehicleType vehicleType = cycle = cycle And num_wheels And num_wheels = 2 = 2 And motor = no And motor = no Then vehicle = Bicycle Then vehicle = Bicycle Tricycle: if Tricycle: if vehicleType vehicleType = cycle = cycle And And num_wheels num_wheels = 3 = 3 And motor = no And motor = no Then vehicle = Tricycle Then vehicle = Tricycle Motorcycle: if Motorcycle: if vehicleType vehicleType = cycle = cycle And And num_wheels num_wheels = 2 = 2 And motor = yes And motor = yes Then vehicle = Motorcycle Then vehicle = Motorcycle Sportscar Sportscar: if : if vehicleType vehicleType = automobile = automobile And size = small And size = small And And num_doors num_doors = 2 = 2 Then vehicle = Then vehicle = Sportscar Sportscar

  7. Reasoning with Rules- -5 5 Reasoning with Rules Sedan: if Sedan: if vehicleType vehicleType = automobile = automobile And size = small And size = small And And num_doors num_doors = 4 = 4 Then vehicle = Sedan Then vehicle = Sedan MiniVan MiniVan: if : if vehicleType vehicleType = automobile = automobile And size = medium And size = medium And And num_doors num_doors = 3 = 3 Then vehicle = Then vehicle = MiniVan MiniVan SUV: if SUV: if vehicleType vehicleType = automobile = automobile And size = large And size = large And And num_doors num_doors = 4 = 4 Then vehicle = Then vehicle = Sports_utility_vehicle Sports_utility_vehicle Cycle: if Cycle: if num_wheels num_wheels < 4 < 4 Then Then vehicleType vehicleType = Cycle = Cycle Automobile: if Automobile: if num_wheels num_wheels = 4 = 4 And motor = yes And motor = yes Then Then vehicleType vehicleType = automobile = automobile

  8. Forward chaining- -1 1 Forward chaining � Forward chaining is a reasoning process in which a set of rules is is Forward chaining is a reasoning process in which a set of rules used to derive new facts from an initial set of data. used to derive new facts from an initial set of data. � The forward chaining cycle: The forward chaining cycle: load the rule base into the inference engine and load any facts from the from the load the rule base into the inference engine and load any facts 1. 1. knowledge base into the working memory knowledge base into the working memory add any additional data into the working memory add any additional data into the working memory 2. 2. match the rules against the data in the working memory and deter match the rules against the data in the working memory and determine mine 3. 3. which rules are triggered, meaning that all of their antecedent clauses are clauses are which rules are triggered, meaning that all of their antecedent true. This set is called conflict set true. This set is called conflict set use the conflict resolution procedure to select a single rule from the conflict om the conflict use the conflict resolution procedure to select a single rule fr 4. 4. set set fire the selected rule by evaluating the consequent clause; either update the er update the fire the selected rule by evaluating the consequent clause; eith 5. 5. working memory if it is a fact- -generating rule, or call the effector procedure, generating rule, or call the effector procedure, working memory if it is a fact if it is an action rule. This is referred to as the act step if it is an action rule. This is referred to as the act step repeat steps 3,4, and 5 until the conflict set is empty repeat steps 3,4, and 5 until the conflict set is empty 6. 6.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend