* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download ARTIFICIAL INTELLIGENCE
Survey
Document related concepts
Transcript
REV 02 CHAPTER 4 Reasoning and Inference Techniques BIC 3337 EXPERT SYSTEM 1 INTRODUCTION REV 02 From the previous chapter, once the knowledge representation in the knowledge base is completed, or is at least at a high level of accuracy, it is ready to be used. A computer program is needed to access the knowledge for making inferences. This program is an algorithm that controls a reasoning process and is usually called the inference engine or the control program. This program is also called rule interpreter. BIC 3337 EXPERT SYSTEM 2 CATEGORIES OF REASONING REV 02 Reasoning can be defined in different ways, depending on whether it is used in the context of idealist philosophy or logic and argument Within idealist philosophical contexts, reasoning is "the mental process that informs our imagination, perceptions, thoughts, and feelings with whatever intelligibility these might have. Two major categories are : model-based reasoning (MBR) and case-based reasoning (CBR). BIC 3337 EXPERT SYSTEM 3 REV 02 CASE-BASED REASONING (CBR) CBR allows one to build a library of cases, or experiences, which are described according to a fixed set of descriptors called the domain model. The domain model has features (such as "Smoke Colour") and values (such as "black", "white", etc.). Later on, one can call up relevant cases by specifying a set of Feature-Values. Cases will be sent to the user with a similarity rating which tells him what percentage of the case values correspond to the values of the query. BIC 3337 EXPERT SYSTEM 4 MODEL-BASED REASONING (MBR) REV 02 The Model-Based Reasoning (MBR) can be viewed as the symbolic processing of an explicit representation of the internal workings of a system in order to predict, simulate, and/or explain the resultant behavior of the system from the structure, causality, functional and behavior of its components. BIC 3337 EXPERT SYSTEM 5 MODEL-BASED REASONING (MBR) REV 02 Thus, the first step in MBR is building an accurate representation (model) of the system that you want to be able to reason about. Once there is a complete model and an algorithm which correctly reproduces the relationships and behavior of the system, one can get complete, precise solutions based on a set of inputs. BIC 3337 EXPERT SYSTEM 6 INFERENCE TECHNIQUES REV 02 Modus Ponens In logic, modus ponens (Latin: mode that affirms; often abbreviated MP) is a valid, simple argument form It is a very common form of reasoning, and takes the following form: If P, then Q. P Therefore, Q BIC 3337 EXPERT SYSTEM 7 Modus Ponens REV 02 In logical operator notation: The modus ponens rule may also be written as: BIC 3337 EXPERT SYSTEM 8 REV 02 INFERENCE TECHNIQUES Resolution In mathematical logic and automated theorem proving, resolution is a rule of inference leading to a refutation theoremproving technique for sentences in propositional logic and first-order logic The resolution rule in propositional logic is a single valid inference rule producing, from two clauses, a new clause implied by them (a clause is a disjunction of literals, where a literal is an atom or a negated atom) BIC 3337 EXPERT SYSTEM 9 Resolution REV 02 The resolution rule takes two clauses containing complementary literals (i.e. literals with the same atom, but opposing signs), and produces a new clause with all the literals of both except for the complementary ones Formally, whereas ai and bj are complementary literals: BIC 3337 EXPERT SYSTEM 10 REV 02 Resolution The clause produced by the resolution rule is called the resolvent of the two input clauses When the two clauses contain more than one pair of complementary literals, the resolution rule can be applied (independently) for each such pair However, only the pair of literals that are resolved upon can be removed: all other pair of literals remain in the resolvent clause BIC 3337 EXPERT SYSTEM 11 REV 02 A Resolution Technique When coupled with a complete search algorithm, the resolution rule yields a sound and complete algorithm for deciding the satisfiability of a propositional formula, and, by extension, the validity of a sentence under a set of axioms This resolution technique uses proof by contradiction and is based on the fact that any sentence in propositional logic can be transformed into an equivalent sentence in conjunctive normal form BIC 3337 EXPERT SYSTEM 12 Resolution REV 02 The steps are as follow: – All sentences in the knowledge base and the negation of the sentence to be proved (the conjecture) are conjunctively connected – The resulting sentence is transformed into a conjunctive normal form (treated as a set of clauses, S) – The resolution rule is applied to all possible pairs of clauses that contains complementary literals BIC 3337 EXPERT SYSTEM 13 REV 02 Resolution After each application of the resolution rule, the resulting sentence is simplified by removing repeated literals. If the sentence contains complementary literals, it is discarded (as a tautology) If not, and if it is not yet present in the clause set S, it is added to S, and is considered for further resolution inferences BIC 3337 EXPERT SYSTEM 14 Resolution REV 02 If after applying a resolution rule the empty clause is derived, the complete formula is unsatisfiable (or contradictory), and hence it can be concluded that the initial conjecture follows from the axioms If, on the other hand, the empty clause cannot be derived, and the resolution rule cannot be applied to derive any more new clauses, the conjecture is not a theorem of the original knowledge base BIC 3337 EXPERT SYSTEM 15 REV 02 CONTROL STRATEGIES Forward-chaining inference is often called data driven — in contrast to backwardchaining inference, which is referred to as goal driven reasoning. The top-down approach of forward chaining is commonly used in expert systems, such as CLIPS. One of the advantages of forward-chaining over backwards-chaining is that the reception of new data can trigger new inferences, which makes the engine better suited to dynamic situations in which conditions are likely to change. BIC 3337 EXPERT SYSTEM 16 REV 02 Control Strategies Forward Chaining Forward chaining is one of the two main methods of reasoning when using inference rules (in artificial intelligence) Forward chaining starts with the available data and uses inference rules to extract more data (from an end user for example) until an optimal goal is reached An inference engine using forward chaining searches the inference rules until it finds one where the If clause is known to be true BIC 3337 EXPERT SYSTEM 17 Backward Chaining REV 02 One of the two main methods of reasoning when using inference rules Backward chaining starts with a list of goals (or a hypothesis) and works backwards to see if there are data available that will support any of these goals An inference engine using backward chaining would search the inference rules until it finds one which has a Then clause that matches a desired goal If the If clause of that inference rule is not known to be true, then it is added to the list of goals (in order for your goal to be confirmed you must also provide data that confirms this new rule) BIC 3337 EXPERT SYSTEM 18 Backward Chaining REV 02 For example, suppose that the goal is to conclude the color of my pet Fritz, given that he croaks and eats flies, and that the rule base contains the following two rules: 1. If Fritz croaks and eats flies - Then Fritz is a frog 2. If Fritz is a frog - Then Fritz is green This rule base would be searched and the second rule would be selected, because its conclusion (the Then clause) matches the goal (that Fritz is green). It is not yet known that Fritz is a frog, so the If statement is added to the goal list (in order for Fritz to be green, he must be a frog BIC 3337 EXPERT SYSTEM 19 Backward Chaining REV 02 The rule base is again searched and this time the first rule is selected, because its Then clause matches the new goal that was just added to the list (whether Fritz is a frog) The If clause (Fritz croaks and eats flies) is known to be true and therefore the goal that Fritz is a frog can be concluded (Fritz croaks and eats flies, so must be green; Fritz is green, so must be a frog) Because the list of goals determines which rules are selected and used, this method is called goal driven, in contrast to data-driven forward-chaining inference This bottom-up approach is often employed by expert systems BIC 3337 EXPERT SYSTEM 20 REV 02 SEARCHING TECHNIQUES Breadth First Techniques In graph theory, breadth-first search (BFS) is a graph search algorithm that begins at the root node and explores all the neighboring nodes. Then for each of those nearest nodes, it explores their unexplored neighbor nodes, and so on, until it finds the goal. BIC 3337 EXPERT SYSTEM 21 Depth First Search REV 02 Depth-first search (DFS) is an algorithm for traversing or searching a tree, tree structure, or graph. Intuitively, one starts at the root (selecting some node as the root in the graph case) and explores as far as possible along each branch before backtracking Formally, DFS is an uninformed search that progresses by expanding the first child node of the search tree that appears and thus going deeper and deeper until a goal node is found, or until it hits a node that has no children BIC 3337 EXPERT SYSTEM 22 Searching Techniques REV 02 Then the search backtracks, returning to the most recent node it hadn't finished exploring Space complexity of DFS is much lower than BFS (breadth-first search) It also lends itself much better to heuristic methods of choosing a likely-looking branch Time complexity of both algorithms are proportional to the number of vertices plus the number of edges in the graphs they traverse (O(|V| + |E|)) BIC 3337 EXPERT SYSTEM 23 Searching Techniques REV 02 When searching large graphs that cannot be fully contained in memory, DFS suffers from non-termination when the length of a path in the search tree is infinite The simple solution of "remember which nodes I have already seen" doesn't always work because there can be insufficient memory This can be solved by maintaining an increasing limit on the depth of the tree, which is called iterative deepening depthfirst search BIC 3337 EXPERT SYSTEM 24 REV 02 Searching Techniques A depth-first search starting at A, assuming that the left edges in the shown graph are chosen before right edges, and assuming the search remembers previously-visited nodes and will not repeat them (since this is a small graph), will visit the nodes in the following order: A, B, D, F, E, C, G BIC 3337 EXPERT SYSTEM 25 REV 02 Searching Techniques Performing the same search without remembering previously visited nodes results in visiting nodes in the order A, B, D, F, E, A, B, D, F, E, etc. forever, caught in the A, B, D, F, E cycle and never reaching C or G. BIC 3337 EXPERT SYSTEM 26 REV 02 Best First Search Best-first search is a search algorithm which optimizes breadth-first search by expanding the most promising node chosen according to some rule Best-first search estimates the promise of node n by a "heuristic evaluation function f(n) which, in general, may depend on the description of n, the description of the goal, the information gathered by the search up to that point, and most important, on any extra knowledge about the problem domain" BIC 3337 EXPERT SYSTEM 27