Expert Systems • 上課用書 • Expert Systems: Principles and Programming (4th Edition), Giarratano and Riley, ISBN 0534384471 (開發圖書代理) • 上課內容 0. Introduction to Artificial Intelligence 1. Introduction to Expert Systems 2. The Representation of Knowledge 3. Methods of Inference 6. Design of Expert Systems 7. Introduction to CLIPS 8. Advanced Pattern Matching 9. Modular Design, Execution Control, and Rule Efficiency A. Fuzzy CLIPS • 評分方式 • 期末程式 40% • 小考、作業、上課狀況 60%
Chapter 0: Introduction to AI • Artificial Intelligence (AI) • Using methods based on the intelligent behavior of humans and other animals to solve complex problems. -- Ben Coppin • Areas of AI • Perception: computer vision, speech recognition • Understanding: natural language processing, ontology • Reasoning: expert systems, game playing • Learning: machine learning, neural-fuzzy systems • Planning: scheduling, automatic programming • Robotics: a combination of multiple areas
Strong AI vs. Weak AI • Strong AI • A computer can literally think and can be conscious in the same way that a human is conscious • giving a computer program sufficient processing power • providing it with enough intelligence • Weak AI • A computer cannot actually intelligent in the way that a human is • the intelligent behavior is merely modeled by humans and used by computers to solve complex problems • emotions and real consciousness are not reachable
Strong Methods vs. Weak Methods • Do not be confused with strong AI and weak AI • Weak methods in AI • Use logic, reasoning, and other general structures to solve a wide range of problems • It is not necessary to incorporate real world knowledge • Strong methods in AI • Given a great deal of knowledge about the problem and the real world. • Use weak methods to deal with knowledge
Expert Systems “An expert system is a computer system that emulates with the decision-making capabilities of a human expert.” “An intelligent computer program that uses knowledge and inference procedures to solve problems that are difficult enough to require significant human expertise for their solutions”. Professor Edward Feigenbaum Stanford University
Developing expert systems needs strong methods • Knowledge representations • representing the real world knowledge within computers • logic vs. graphical notation vs. frame-based notation • Inference on knowledge • making inferences to solve problems • forward chaining vs. backward chaining
Knowledge Representation • Predicate Logic • Builder(Bob) Dog(Fido) Cat(Fang) owns(Bob,Fido) eats(Bob,Cheese) chases(Fido,Fang) chases(Fang,Mise) eat(Mice,Cheese) • Semantic Nets • Frame
Inference • Forward chaining • data-driven • Backward chaining • goal-driven infer new data infer new data infer ‧‧‧ conclusion known data or facts infer infer infer known goal subgoals solution subgoals ‧‧‧
AI Programming Languages • Prolog (PROgramming in LOGic) • Build a database of facts and rules (in logic) • Answer questions by a process of logical deduction • Backward chaining (backtracking) • LISP (LISt Programming) • Use lists to represent programs and data • Provide list manipulation functions to handle lists • Forward chaining • CLIPS (C Language Integrated Production System) • Build a Knowledge base (rules) • Match known facts and the rules (inference engine) • Forward chaining
Chapter 1:Introduction to Expert Systems Expert Systems: Principles and Programming, Fourth Edition
Objectives • The meaning of an expert system • The characteristics and advantages of an expert system • The applications of expert systems in use today • The structure of an expert system • The stages in the development of an expert system
What is an expert system? “An expert system is a computer system that emulates with the decision-making capabilities of a human expert.” “An intelligent computer program that uses knowledge and inference procedures to solve problems that are difficult enough to require significant human expertise for their solutions”. Professor Edward Feigenbaum Stanford University
Expert system participants • Users • Experts • An expert’s knowledge is specific to one problem domain, as opposed to knowledge about general problem-solving techniques • Knowledge Engineers • Eliciting knowledge from experts and building expert systems
Expert system technology may include: • Special expert system languages – CLIPS • Programs • Hardware designed to facilitate the implementation of those systems
Expert System Main Components • Knowledge base – obtainable from books, magazines, knowledgeable persons, etc. • Inference engine – draws conclusions from the knowledge base
Problem Domain vs. Knowledge Domain • An expert’s knowledge is specific to one problem domain – medicine, finance, science, engineering, etc. • The expert’s knowledge about solving specific problems is called the knowledge domain. • The problem domain is always a superset of the knowledge domain.
Advantages of Expert Systems • Increased availability and reduced cost • expertise can be reused frequently • Reduced danger • can function in environments hazardous to humans • Increased reliability • confidence levels can be increased by providing a second opinion to that of a human • Steady, unemotional, and complete responses at all times • in stressful or fatigue situations which may affect a human expert
Representing the Knowledge • The knowledge of an expert system can be represented in a number of ways, including IF-THEN rules: IF you are hungry THEN eat
Knowledge Engineering The process of building an expert system: • The knowledge engineer establishes a dialog with the human expert to elicit knowledge. • The knowledge engineer codes the knowledge explicitly in the knowledge base. • The expert evaluates the expert system and gives a critique to the knowledge engineer.
The Role of AI • An algorithm is an ideal solution guaranteed to yield a solution in a finite amount of time. • When an algorithm is not available or is insufficient, we rely on artificial intelligence (AI). • Expert system relies on inference – we accept a “reasonable solution” or “feasible solution”
Limitations of Expert Systems • It is easier to program expert systems with shallow knowledge than with deep knowledge • Lack of causal knowledge (deep knowledge) - do not really have an understanding of the underlying causes and effects in a system. • Typical expert systems cannot generalize through analogy to reason about new situations in the way people can. • Knowledge acquisition is the bottleneck of building an expert system. (a time-consuming and labor intensive task)
Shallow Knowledge vs. Deep Knowledge • Shallow Knowledge: • based on empirical and heuristic knowledge (based on syntax) • Algorithmic：guaranteed to have a solution • Heuristic：no guarantee • Deep Knowledge (Causal Knowledge)： • based on the basic structure, function, and behavior of objects (based on semantics) • Example： • Prescribe an aspirin for a person’s headache (shallow) • Programming of a causal model of a human body (deep)
Early Expert Systems • DENDRAL – used in chemical mass spectroscopy to identify chemical constituents • MYCIN – medical diagnosis of illness • DIPMETER – geological data analysis for oil • PROSPECTOR – geological data analysis for minerals • XCON/R1 – configuring computer systems
Problems with Algorithmic Solutions • Conventional computer programs generally solve problems having algorithmic solutions. • Algorithmic languages include C, Java, and VB. • The inability to deal with knowledge-intensive applications or heuristic problem-solving • Classic AI languages include LISP and PROLOG, both used for symbolic manipulation. . • Expert system languages (e.g. CLIPS) focus on ways to represent knowledge
Considerations for Building Expert Systems • Can the problem be solved effectively by conventional programming? • Is there a need and a desire for an expert system? • Is there at least one human expert who is willing to cooperate? • Can the expert explain the knowledge to the knowledge engineer can understand it.
Elements of an Expert System • Knowledge base– rules • Working memory –facts used by rules • Inference engine – makes inferences deciding which rules are satisfied and prioritizing. • Agenda – a prioritized list of rules in the inference engine • Explanation facility – explains reasoning of expert system • Knowledge acquisition facility – the user to enter knowledge in the system bypassing the knowledge engineer • User interface – mechanism by which user and system communicate.
Production Rules • Knowledge base contains production rules • KB is also called production memory • Production rules can be expressed in IF-THEN format • In rule-based systems, the inference engine • determines which rule antecedents (IF parts) are satisfied by the facts • determines a prioritized list of rules
General Methods of Inferencing • Forward chaining – reasoning from facts to the conclusions resulting from those facts – best for prognosis, monitoring, and control. • Backward chaining – reasoning in reverse from a hypothesis, a potential conclusion to be proved to the facts that support the hypothesis – best for planning problems.
Production Systems • Rule-based expert systems – most popular type today. • Knowledge is represented as rules that specify what should be concluded from different situations. • Forward chaining – start with facts and use rules to draw conclusions or take actions (i.e. data driven) • Backward chaining – start with hypothesis and look for rules that allow hypothesis to be proven true (i.e. goal driven)
Procedural Paradigms • Programming paradigms can be classified as: • procedural paradigms: the programmer must specify exactly how a problem solution must be coded (algorithm) • nonprocedural paradigms: the programmer do not give exact details on how the program is to be solved • Algorithm – method of solving a problem in a finite number of steps. • Procedural programs are also called sequential programs • imperative language • functional language
Imperative Language • Focuses on the concept of modifiable store – variables and assignments. • During execution, program makes transition from the initial state to the final state by passing through series of intermediate states. • Because of their sequential nature, imperative languages are not very efficient for directly implementing expert systems.
Functional Language • Not statement-oriented language (e.g., LISP) • Functional programming is centered around functions • The fundamental idea of functional language is to combine simple functions to produce more powerful functions a bottom-up design • opposite from imperative languages – a top-down design
Nonprocedural Paradigms • Nonprocedural paradigms • declarative language • non-declarative language • Declarative programming • goal is separated from the method used to achieve it (the user specifies the goal while the underlying mechanism of the implementation tries to satisfy the goal) • OOP is partly imperative and partly declarative • the data used by the program is objects and then implement operations that act on those objects • subclasses derived from parent classes (inheritance) • Logic programming (e.g. PROLOG), rule-based programming (e.g. CLIPS), and induction-based programming (e.g. SQL)
What are suitable for Expert Systems? • Can be considered declarative languages: • Programmer does not specify how a program is to achieve its goal at the level of algorithm. • Object-oriented programming (but partly imperative) • Logic programming • Rule-based programming • Frame-based programming
Summary • Expert systems are knowledge-based – effective for solving real-world problems. • Expert systems are also called knowledge-based systems • Expert systems solve problems for which there are no known algorithms. • Expert systems are not suited for all applications.
Chapter 2:The Representation of Knowledge Expert Systems: Principles and Programming, Fourth Edition
Objectives • Learn the meaning and the category of knowledge • Learn about semantic nets • Learn about schemas • Learn about frames • Learn about conceptual graphs • Learn how to use logic and set symbols to represent knowledge
Knowledge Representationvs. Expert Systems • Knowledge affects the development, efficiency, speed, and maintenance of the expert system. • Knowledge representation is the key to the success of expert systems. • Expert systems are designed for a certain type of knowledge representation based on rules of logic
Categories of Knowledge • procedural knowledge • knowing how to do something fix a watch, install a window, brush your teeth. • declarative knowledge • knowing that something is true or false usually associated with declarative statements such as “Don’t touch that hot wire.” • tacit knowledge vs. explicit knowledge • (unconscious knowledge) cannot be expressed by language knowing how to walk, how to breathe, etc.
Knowledge in Rule-Based Systems • Knowledge refers to rules that are activated by facts or other rules. • Activated rules produce new facts or conclusions. • Conclusions are the end-product of inferences when done according to formal rules.
Metaknowledge • Metaknowledge is knowledge about knowledge and expertise. • In an expert system, an ontology is the metaknowledge that describes everything known about the problem domain. • Most successful expert systems are restricted to as small a domain as possible.
Knowledge Representation Techniques A number of knowledge-representation techniques have been devised: • Rules • Semantic nets • Frames • Scripts • Logic • Conceptual graphs