Introduction to Expert System Lecture Notes PDF

Document Details

ViewableIntellect5950

Uploaded by ViewableIntellect5950

GOU

Tags

expert systems artificial intelligence knowledge representation computer science

Summary

This document is a lecture note on Introduction to Expert Systems. The lecture notes cover various topics such as course content, expert system components, types of expert systems, and knowledge representation. The note provides a detailed overview of the subject.

Full Transcript

GOU-CSO103 (INTRODUCTION TO EXPERT SYSTEM) Course Outline Module 1: Course Introduction & Overview of Expert Systems 1.0 Overview of Course Content and Objectives 1.1 Introduction to Expert Systems 1.2 Definition and Basic Concept 1.3 Difference between Expert Systems and Conventional Systems 1.4 Th...

GOU-CSO103 (INTRODUCTION TO EXPERT SYSTEM) Course Outline Module 1: Course Introduction & Overview of Expert Systems 1.0 Overview of Course Content and Objectives 1.1 Introduction to Expert Systems 1.2 Definition and Basic Concept 1.3 Difference between Expert Systems and Conventional Systems 1.4 The Human Elements in Expert Systems development 1.5 Features of Expert Systems 1.6 Real-world examples of expert systems Module 2: Components of Expert Systems 2.1 Components of Expert Systems 2.2 Development of an Expert System 2.3 Stages of Development (Knowledge Acquisition, Representation, Testing) Module 3: The Need for Expert Systems & Applications 3.1 Why Expert Systems? 3.2 Human Expert Limitations, Consistency, Efficiency 3.3 Cost Savings in Expert System Implementation 3.4 Applications of Expert Systems Module 4: Knowledge Representation in Expert Systems 4.1 Introduction to Knowledge Representation 4.2 Rules, Facts, and Procedures in Knowledge Representation 4.3 Knowledge Representation Techniques (Logic-based, Semantic Networks, Frames, and Scripts) Module 5: Rule-Based Expert Systems 5.1 Introduction to Rule-Based Expert Systems 5.2 MYCIN- as an example of Rule Based Expert System 5.3 If-Then Rules, Forward and Backward Chaining 5.4 Building a Simple Rule-Based Expert System Module 6: Frame-Based Expert Systems 6.1 Understanding Frames in Expert Systems 6.2 Frame Representation and Use Cases 6.3 Comparing Frame-Based and Rule-Based Expert Systems 6.4 Advantages and Disadvantages Module 7: Fuzzy and Neural Network Based Expert Systems 7.1 Introduction to Fuzzy Logic in Expert Systems 7.2 Concepts of Fuzziness, Fuzzy Sets, and Decision Making 7.3 Neural Network-Based Expert Systems 7.4 Overview of Neural Networks and their Application in Expert Systems Module 8: Blackboard Expert System – HEARSAY 8.1 Introduction to Blackboard Architecture 8.2 Structure, Components, and Communication in Blackboard Systems 8.3 Case Study: HEARSAY System 8.4 How HEARSAY Utilized Blackboard Architecture for Speech Recognition Module 1: Course Introduction & Overview of Expert Systems 1.0 Course aim and Objectives 1.1 Introduction to Expert Systems 1.2 Definition and Basic Concept 1.3 Difference between Expert Systems and Conventional Systems 1.4 The Human Elements in Expert Systems development 1.5 Features of Expert Systems 1.6 Real-world examples of expert systems 1.0 Course Aim and Objectives The aim of the course is simple. The course aims to provide students with an understanding of Expert Systems. To achieve the aim set out, the course has a set of objectives which are included at the beginning of the study. You should read these objectives before you start the course. You may wish to refer to them during your study to check on your progress. You should always look at the objectives after completion of each unit. Students are expected to understand and Course objectives are: 1. Basic Concept of Expert Systems 2. Components of expert systems, and development of an expert system 3. The need for Expert Systems and Applications 4. Knowledge Representation in expert systems and Classes of Expert Systems 5. Rule-based expert systems 6. Frame-based expert systems 7. Fuzzy logic-based expert systems 8. Neural network-based expert systems 9. Expert Systems Characteristics and Application 10. Natural Language Interface for Expert Systems 11. Programming Language for Developing Expert System 12. Blackboard Expert System – HEARSAY 1.1 Introduction to Expert Systems Expert systems (ES) emanate from the new area of computing known as artificial intelligence (AI). AI is the branch of computer science concerned with developing computers that behave like humans. Expert systems are central in the cognitive science aspect of artificial intelligence, as shown in Figure 1 below. Figure 1.1: Showing the place of expert systems in the broad AI domain 1.2 What is an Expert Systems: An expert system is a computer program that simulates the judgment and behavior of a human or an organization that has expert-level knowledge in a particular domain. These systems are designed to solve complex problems by reasoning through bodies of knowledge, represented mainly as if-then rules (or production rules). An expert system belongs to the field of artificial intelligence, and it is a computer program that simulates the judgment and behavior of an individual who has expert knowledge and experience in a particular field. It is a knowledge-based computer program that exhibits a degree of expertise in a particular domain, thereby solving problems or making decisions that are comparable to those of a human expert. ES is a type of application program that makes decisions or solves problems in a particular field by using knowledge and analytical rules defined by experts in the field. Expert systems represent a branch of artificial intelligence that aims to take the experience of human specialists and transfer it to a computer system. Specialty knowledge is stored in the computer, which by an execution system (inference engine) is reasoning, and it derives specific conclusions for the problem. An Expert System (EPS) is a software system that finds solutions based on expert knowledge or provides an evaluation of known problems. Examples are systems for the support of medical diagnosis or the analysis of scientific data. Despite these definitions of expert systems by different authors, it is important to summarize that an expert system is a knowledge-based computer program that exhibits, within a specific domain, a degree of expertise in problem-solving that is comparable to that of a human expert. This problem method uses a knowledge base, which is carefully formulated based on expert judgment, intuition, and experience. Thus, an expert system embodies the cognition and ability of an expert in a certain realm, thus emulating the decision-making ability of a human. 1.3 Basic Concept in Expert System 1.2.1 The Role of Heuristic Knowledge in Expert Systems Much of the knowledge of domain experts in solving practical problems consists of heuristics acquired through learning and experience. A heuristic is a rule of thumb, fact, or even a procedure that can be used to solve some problem, but it is not guaranteed to do so. It may fail. Heuristics can be conveniently regarded as simplifications of comprehensive formal descriptions of a real- world system. For example, it is conceivable that all aspects of the operation of a machine could be completely described in a complex physical or mathematical model, including circumstances under which machines malfunction. In principle, this model could be used to analyze machine problems and (algorithmically) determine malfunctions with virtual certainty. In practice, complete models are often difficult to develop due to a lack of necessary information about the problem and its inherent complexity. Therefore, for many problems, domain experts find it practical and necessary to substitute heuristic knowledge for a complex model. Expert system systems benefit from heuristic principles. 1.2.2 Elements of an Expert System Expert systems store expert knowledge and apply it "on demand" to solve problems. Most often the user of an expert system is a person. The user may also be another software system or even a mechanical device. A human user, known as an end user usually provides information to the expert system via a computer terminal. The expert system uses inference procedures to apply its stored knowledge to the facts describing a problem. The systematic application of inference leads to solutions that are then displayed at the terminal. The operation of an expert system can be viewed in terms of the interaction of distinct components. The knowledge base stores knowledge about how to solve problems. Inference procedures are executed by a software module called the inference engine. If the user of the expert system is a person, communications with the end-user are handled via an end user interface. Each of the major parts of the expert system architecture can be further explain as below: Fig 1.2: Block diagram of an Expert system a. The Knowledge Base Knowledge is stored in the knowledge base using symbols and data structures to stand for important concepts. The symbols and data structures are said to represent knowledge. Knowledge representation can take many forms. The most common form is the production rule. Production rules are a particularly convenient way of expressing heuristic knowledge. The knowledge base refers to the actual store of knowledge for a particular expert system. A knowledge representation system may be simple, consisting only of data structures for representing rules. Or knowledge representation may incorporate other more complex structures. Knowledge represented in data structures, such as rules, is said to be stated declaratively. Declarative knowledge is knowledge that is stated explicitly and is intended to be accessible to persons who may need to see it, such as domain experts. The ability to make its declarative knowledge accessible and understandable is one of the most important services provided by a knowledge representation system. b. The Inference Engine The inference engine is a software module that executes procedures for applying knowledge to produce new information about a problem. In production rule systems, an inference engine compares rules against known facts in the context file to determine if new facts can be inferred. The conditions in the premise, or IF part, of the production rules are compared against known facts. If these conditions are satisfied, the facts in the conclusion, or THEN part, can be inferred. The newly concluded facts are then added to the context file of the expert system. c. Expert System Interfaces Expert systems communicate with human users as well as other software and hardware systems. Expert systems communicate with human users via an end user interface. The purpose of the end user interface is to obtain information about the problem from the end user and to display solutions. To obtain information, the interface may display questions at a terminal and prompt the end user for answers. Solutions may consist of text statements. More elaborate end user interfaces may use graphics and hypertext. A useful function of an expert system is the ability to explain its actions. While using an expert system, the end user may wish to know why questions are being asked or why certain facts were concluded. When the solution is displayed to the end user, the user may request an explanation of how the solution was reached. The end user interface contains procedures that generate explanations that can be shown to the end user. In many practical applications, an expert system must interface, and exchange data, with other software and hardware systems. The number of expert systems that have non-human users, such as other software systems or electronic process control devices, is increasing. Therefore, it is important to note that the expert system interface with both end-user and other non-human components. 1.3 Difference between Expert Systems and Conventional Systems a) Expert Systems: i. Purpose: Focus on problem-solving in specific domains (e.g., medical diagnosis, financial forecasting). ii. Knowledge-Based: Depend heavily on a structured knowledge base and can provide expert-level decisions. iii. Flexibility: Can be updated with new knowledge to improve performance. iv. Explanation Capabilities: Can explain the reasoning behind decisions. v. Performance: Often provide consistent results in areas where human experts might differ. b) Conventional Systems: i. Purpose: Typically designed for general data processing tasks and automating routine operations (e.g., word processing, spreadsheets). ii. Rule-Based Logic: Often rely on predefined algorithms and do not change with new data. iii. Limited Adaptability: Changes in processes require reprogramming or manual updates. iv. User Interaction: This may not provide detailed explanations of processes or outcomes. 1.4 The Human Elements in Expert Systems development Building an expert system is known as knowledge engineering and its practitioners are called knowledge engineers. The knowledge engineer must make sure that the computer has all the knowledge needed to solve a problem. Moreover, it is important to identify different kinds of people who are needed to develop and use an expert system and what skills are needed. In general, there are five members of the expert system development team: the domain expert, the knowledge engineer, the programmer, the project manager and the end-user. The success of the expert system entirely depends on how well the members work together. Figure 1.3: Showing the human factors in the expert system development teams a. Domain expert: Anyone can be considered a domain expert if he or she has deep knowledge (of both facts and rules) and strong practical experience in a particular domain. In general, an expert is a skillful person who can do things other people cannot. Consider several Human Expert examples: A doctor, Chess grands–master, Financial wizard, A chef, an Engineer, an architect, a pharmacist e.t.c. b. Knowledge engineers: The individual who encodes the expert' knowledge in a declarative form that can be used by the expert system. They are also people who are capable of designing, building and testing an expert system. This person is responsible for selecting an appropriate task for the expert system. He or she interviews the domain expert to find out how a particular problem is solved. Through interaction with the expert, the knowledge engineer establishes what reasoning methods the expert uses to handle facts and rules and decides how to represent them in the expert system. The knowledge engineer then chooses some development software or an expert system shell, or looks at programming languages for encoding the knowledge (and sometimes encodes it himself). And finally, the knowledge engineer is responsible for testing, revising and integrating the expert system into the workplace. Thus, the knowledge engineer is committed to the project from the initial design stage to the final delivery of the system, and even after the project is completed, he or she may also be involved in maintaining the system. c. The programmer: is the person responsible for the actual programming, describing the domain knowledge in terms that a computer can understand. The programmer needs to have skills in symbolic programming in such AI languages as LISP, and Prolog and also some experience in the application of different types of expert system shells. In addition, the programmer should know conventional programming languages like Python, R, Java, Julia, C, Pascal, FORTRAN e.t.c. If an expert system shell is used, the knowledge engineer can easily encode the knowledge into the expert system and thus eliminate the need for the programmer. However, if a shell cannot be used, a programmer must develop the knowledge and data representation structures (knowledge base and database), control structure (inference engine) and dialogue structure (user interface). The programmer may also be involved in testing the expert system. d. The project manager: is the leader of the expert system development team, responsible for keeping the project on track. He or she makes sure that all deliverables and milestones are met, interacts with the expert, knowledge engineer, programmer and end-user. e. User: often called just the end-user, is an individual who will be consulting with the system to get advice which would have been provided by the expert. He or she is a person who uses the expert system when it is developed. The user might be an analytical chemist determining the molecular structure of soil from Mars, a junior doctor diagnosing an infectious blood disease, an exploration geologist trying to discover a new mineral deposit, or a power system operator needing advice in an emergency. Each of these users of expert systems has different needs, which the system must meet: the system‟s final acceptance will depend on the user‟s satisfaction. The user must not only be confident in the expert system performance but also feel comfortable using it. Therefore, the design of the user interface of the expert system is also vital for the project‟s success; the end-user‟s contribution here can be crucial. Possible Classes of Users ❖ A non-expert client seeking direct advice - the ES acts as a Consultant or Advisor ❖ A student who wants to learn ❖ An ES builder improving or increasing the knowledge base – a Partner ❖ An expert - a Colleague or Assistant It is important to note that the development of an expert system can be started when all five players have joined the team. However, many expert systems are now developed on personal computers using expert system shells. This can eliminate the need for the programmer and also might reduce the role of the knowledge engineer. For small expert systems, the project manager, knowledge engineer, programmer and even the expert could be the same person. But all team players are required when large expert systems are developed. 1.5 Features of Expert Systems Expert system operates as an interactive system that responds to questions, asks for clarifications, makes recommendations and generally aids the decision-making process. Expert systems have many features: i. Operates as an interactive system This means an expert system : ❖ Responds to questions ❖ Asks for clarifications ❖ Makes recommendations ❖ Aids the decision-making process. ii. Tools have ability to sift (filter) knowledge ❖ Storage and retrieval of knowledge ❖ Mechanisms to expand and update knowledge base on a continuing basis. iii. Make logical inferences based on knowledge stored ❖ Simple reasoning mechanisms is used ❖ Knowledge base must have means of exploiting the knowledge stored, else it is useless; e.g., learning all the words in a language, without knowing how to combine those words to form a meaningful sentence. iv. Ability to Explain Reasoning ❖ Remembers logical chain of reasoning; therefore user may ask 1. for explanation of a recommendation 2. factors considered in recommendation ❖ Enhances user confidence in recommendation and acceptance of expert system v. Domain-Specific ❖ A particular system caters a narrow area of specialization; e.g., a medical expert system ❖ Quality of advice offered by an expert system is dependent on the amount of knowledge vi. Capability to assign Confidence Values ❖ Can deliver quantitative information ❖ Can interpret qualitatively derived values ❖ Can address imprecise and incomplete data through assignment of confidence values. vii. Cost-Effective alternative to Human Expert ❖ Expert systems have become increasingly popular because of their specialization, albeit in a narrow field. ❖ Encoding and storing the domain-specific knowledge is economic process due to small size. ❖ Specialists in many areas are rare and the cost of consulting them is high; an expert system of those areas can be useful and cost-effective alternative in the long run. viii. Goal Driven Reasoning or Backward Chaining An inference technique which uses IF-THEN rules to repetitively break a goal into smaller sub- goals which are easier to prove; ix. Coping with Uncertainty The ability of the system to reason with rules and data which decision to make. Often the Knowledge is imperfect which causes uncertainty and to work in the real world, Expert systems must be able to deal with uncertainty. ❖ one simple way is to associate a numeric value with each piece of information in the system. ❖ the numeric value represents the certainty with which the information is known. ❖ There are different ways in which these numbers can be defined, and how they are combined during the inference process. x. Data Driven Reasoning or Forward Chaining An inference technique which uses IF-THEN rules to deduce a problem solution from initial data; xi. Data Representation ❖ Data representation is the way in which the problem specific data in the system is stored and accessed. Expert system is built around a knowledge base module. ❖ Knowledge acquisition is transferring knowledge from human expert to computer. ❖ Knowledge representation is faithful representation of what the expert knows. No single knowledge representation system is optimal for all applications. The success of expert system depends on choosing knowledge encoding scheme best for the kind of knowledge the system is based on. The IF-THEN rules, Semantic networks, and Frames are the most commonly used representation schemes. xii. User Interface The user interface is the portion of the system which creates an intermediary between the system and the user for interaction. The acceptability of an expert system depends largely on the quality of the user interface. ❖ Scrolling dialog interface: It is easiest to implement and communicate with the user. ❖ Pop-up menus, windows, mice are more advanced interfaces and powerful tools for communicating with the user; they provide graphic support. xiii. Explanations The ability of the system to explain the reasoning process that it used to reach a recommendation. An important feature of expert systems is their ability to explain themselves. Given that the system knows which rules were used during the inference process, the system can provide those rules to the user as means for explaining the results. By looking at explanations, the knowledge engineer can see how the system is behaving, and how the rules and data are interacting. This is very valuable diagnostic tool during development. 1.6 Real-World Examples of Expert Systems 1. MYCIN: An early expert system developed at Stanford University for diagnosing bacterial infections and recommending antibiotics. It used a rule-based approach and could explain its reasoning. 2. DENDRAL: An expert system designed for chemical analysis to help chemists identify molecular structures. It was one of the first expert systems developed. 3. CLIPS (C Language Integrated Production System): A tool for building expert systems that provides a framework for knowledge representation and inference. 4. XCON (also known as R1): Developed by Digital Equipment Corporation (DEC) to assist in the configuration of computer systems. It was instrumental in automating a critical part of the manufacturing process. 5. Financial Expert Systems: Systems like Expert Financial Planner that provide advice on investments, savings, and financial planning based on user data and goals. 6. Medical Diagnosis Systems: Systems like CADUCEUS, assists doctors by providing diagnostic suggestions based on patient symptoms and history. Module 2: Components of Expert Systems 2.1 Components of Expert Systems 2.2 Development of an Expert System 2.3 Stages of Development (Knowledge Acquisition, Representation, Testing) 2.1 Components of Expert Systems The key goal of an expert system is to assist users in solving problems or making decisions in areas where human expertise is required, such as medical diagnosis, financial forecasting, and technical troubleshooting. Expert systems are usually built for specific application areas called Domain. An expert system typically consists of five core components: 1. Knowledge Base 2. Inference Engine 3. User Interface 4. Explanation Facility 5. Knowledge Acquisition Module Figure 2.1: Architecture of an Expert system 1. Knowledge Base The knowledge base is the central repository of facts and rules within an expert system. It contains domain-specific information that is provided by human experts or gathered through experience. It is the collection of facts and rules which describe all the knowledge about the problem domain. The knowledge base contains the knowledge necessary for understanding, formulating, and solving problems. Knowledge is the primary raw material of AS, in a rule-based expert system, the knowledge is represented as a set of rules. Each rule specifies a relation, recommendation, directive, strategy or heuristic and has the IF (condition) THEN (action) structure. When the condition part of a rule is satisfied, the rule is said to fire and the action part is executed. Key Features of the Knowledge Base: Facts: These are raw data or basic truths about the problem domain (e.g., "If the engine is overheating, the fan might be broken"). Rules: These are "if-then" statements that define relationships between facts and represent expert knowledge (e.g., "If the car won’t start, then check the battery"). 2. Inference Engine The inference engine is the brain of the expert system. It processes the information in the knowledge base to draw conclusions or make decisions. Essentially, the inference engine applies logical reasoning to the facts and rules in the knowledge base. Inference engine carries out the reasoning whereby the expert system reaches a solution. It links the rules given in the knowledge base with the facts provided in the database. ❖ Makes inferences deciding which rules are satisfied and prioritizing. ❖ The brain of the ES ❖ The control structure (rule interpreter) ❖ Provides methodology for reasoning ❖ An inference engine tries to derive answers from a knowledge base (chooses which facts and rules to apply when trying to solve the users query. There two types of inference engine, they are: 1. Forward Chaining: The system starts with available facts and applies rules to reach a conclusion. This approach is data-driven and is often used when the outcome is uncertain (e.g., medical diagnosis) i.e. if the conditions of the rule ‗if A and B then C„ are true, then C is added to working memory. 2. Backward Chaining: The system starts with a goal or hypothesis and works backward to determine if the facts support that conclusion. This is goal-driven reasoning, commonly used for problem-solving (e.g., debugging a software issue). i.e. The rule ‗if A and B then C„, the backward chaining engine will try to prove C by first proving A and then proving B. Proving these conditions to be true, may well invoke further calls to the engine and so on. The inference engine helps the system simulate the thinking process of a human expert. Inference Engine Tasks: ❖ Evaluate the conditions of rules. ❖ Apply the rules to current data or facts. ❖ Resolve conflicts between multiple applicable rules (known as conflict resolution). 3. User Interface The user interface is the component that allows the user to interact with the expert system. A good user interface makes it easy for users to input data, receive recommendations or solutions, and understand how the system works. UI is the part of the system which takes in the users query in a readable form and passes it to the inference engine then displays the results to the user. It is also a mechanism by which user and system communicate. Features of a User Interface: ❖ Input Methods: Users can input data through forms, command lines, or natural language (e.g., typing symptoms for a medical diagnosis). ❖ Output Methods: The system displays the results in an easy-to-understand format, often in text or graphical form. ❖ Feedback: The system can ask clarifying questions to refine its reasoning or decision- making. The user interface should be user-friendly, even for non-experts, so that anyone can benefit from the expert system's capabilities. 4. Explanation Facility The explanation facility is a crucial part of the expert system, enabling the system to explain its reasoning process to the user. This makes the system more transparent and trustworthy. This component is especially important in sensitive domains, like healthcare, where users need to trust and understand the recommendations provided. Functions of the Explanation Facility Justification of Decisions: The system can explain why it arrived at a particular conclusion (e.g., “I diagnosed a cold because you have symptoms like sneezing, runny nose, and sore throat”). Traceability: It can show the step-by-step process it followed to make a decision, including which facts and rules were used. Educational Tool: The explanation facility can serve as a teaching tool, helping users learn from the system’s knowledge and decision-making process. 5. Knowledge Acquisition Module The knowledge acquisition module is responsible for gathering and updating the knowledge base. It is how the expert system learns from new information and expands its expertise. Methods of Knowledge Acquisition: Manual Input: Human experts or knowledge engineers input facts and rules manually. Automatic Learning: In some systems, the knowledge base can be updated automatically by learning from new data (e.g., machine learning techniques). Interviews with Experts: Knowledge engineers gather information by interviewing domain experts and encoding their knowledge into the system. 2.2 Development of an Expert System The process of building an expert system is called knowledge engineering. Correspondingly, developers of expert systems are referred to as knowledge engineers. 2.2.1 Knowledge engineering or knowledge-based engineering Expert system technologies are varieties of artificial intelligence (AI) approaches in which decision-making knowledge is codified and modeled, the process of designing an expert system through the AI approaches is called knowledge-based engineering. The process of building an expert system is a semblance of an attempt to capture rare or important expertise and embody it in computer code. This process involves a rigor of intellectual cloning to inject an expert knowledge into an artificial object. Expert system builders, the knowledge engineers, find out from experts what they know and how they use their knowledge to solve a particular problem. Once this debriefing is done, the expert system builders incorporate the knowledge and expertise in computer programs, making the knowledge and expertise easily replicated, readily distributed, and essentially immortal. It consists of three stages: 1. Knowledge acquisition: the process of obtaining the knowledge from experts (by interviewing and/or observing human experts, reading specific books, e.t.c). 2. Knowledge representation: selecting the most appropriate structures to represent the knowledge (lists, sets, scripts, decision trees, object–attribute–value triplets, e.t.c). 3. Knowledge validation: testing that the knowledge of ES is correct and complete Figure 2.2: The structure of knowledge engineering process The concept of knowledge-based engineering grew out of the early work on expert systems in the seventies. With the growing popularity of knowledge-based systems, there arose also a need for a systematic approach for building such systems, similar to methodologies in main-stream software engineering. Over the years, the discipline of knowledge engineering has evolved into the development of theory, methods and tools for developing knowledge-intensive applications. In other words, it provides guidance about when and how to apply particular knowledge-presentation techniques for solving particular problems. 2.3 Stages of Development of an Expert System The development of an expert system typically follows these stages: 1. Knowledge Acquisition This is the process of gathering relevant knowledge from human experts or other sources to form the basis of the expert system, and the knowledge can come from interviews, observations, or reviewing documentation. This step is essential because the system’s performance depends largely on the quality of the knowledge collected. Tools used for knowledge acquisition: ❖ Interview techniques (Structured/Unstructured) ❖ Observation of expert behavior ❖ Documentation of problem-solving approaches Challenges: ❖ Expert knowledge can be difficult to express formally. ❖ Experts might not always be able to clearly articulate their problem-solving processes. 2. Knowledge Representation After acquiring knowledge, it needs to be structured and stored in a format that the computer can process. This is known as knowledge representation. Common techniques for knowledge representation: ❖ Production Rules: Represent knowledge as a set of rules, usually in the form of "IF condition THEN action." ❖ Frames: A structure for dividing knowledge into substructures by representing "objects" and their "attributes." ❖ Semantic Networks: A graphical representation of knowledge where concepts are nodes, and relationships between them are edges. ❖ Logic: Representing knowledge in formal logical statements (propositional or first-order logic). Example: Rule: IF the patient has a fever AND has a cough THEN the patient may have the flu. 3. Testing Testing is the process of evaluating the expert system’s performance, the goal is to ensure that the system is making accurate decisions and that it can generalize well to new, unseen problems. Phases of Testing: 1. Verification: Checking if the system behaves as intended, following the knowledge and rules correctly. 2. Validation: Ensuring the system’s decisions align with expert opinions or the real- world scenarios it’s supposed to handle. 3. Debugging: Identifying and correcting any errors in the knowledge base or inference engine. Techniques for Testing: ❖ Test Cases: Real-world or hypothetical scenarios to test if the system provides correct conclusions. ❖ Comparison with Human Experts: Comparing the system's output with that of a human expert to measure its accuracy. ❖ User Feedback: Involving users to evaluate the system’s usability and effectiveness in decision-making. 2.3.1The steps in a typical expert systems analysis and design methodology are summarized below Expert systems are developed iteratively in a series of repeated steps. These steps roughly consist of knowledge acquisition, followed by system design (or modification of an existing design, system development (including knowledge entry) and system testing and evaluation. 1. Identification phase The first step in the identification phase, to identify problem, is similar to the problem definition phase in the traditional systems development life cycle. The objective is to identify, characterize, and define the problems the system will be expected to solve and then partition the problem into appropriate sub-tasks. Once the problem is defined, the resources necessary for acquiring knowledge, implementing the system, and testing the system are identified. Typical resources include knowledge, time, computing facilities, and money. Because expert systems are expensive and creating one takes considerable time, a feasibility study is often conducted before work progresses beyond this point. In addition to identifying resources, the expert system analysts and/or designers also identify the system’s goals and objectives. It is helpful to identify and explicitly document the goals because certain design approaches, such as heuristic search, breadth search, depth search, and reasoning are goal-driven. 2. Conceptualization phase The central task of the conceptualization phase is to put in a diagram the system’s key concepts and relations to define a conceptual base for a prototype system. Key objectives include separating the inference engine from the problem domain, factoring (analyzing) the problem into meta- problems, identifying the system’s key concepts and relations, and testing those concepts and relations by challenging them (with specific examples of problem-solving activities) to ensure that they cover every general case. Many of the tools and techniques are used in this phase. Figure 2.3: Iterative Development of an Expert System 3. Formalization Phase The formalization phase involves mapping key concepts, sub-problems, and information flow characteristics isolated during conceptualization into more formal representations based on various knowledge engineering and problem solving tools and knowledge representation frame-works. The key objectives are to identify the solution space (a domain with a collection of all possible solutions), the hypothesis space (the hypothetical solution space), the underlying model, and the characteristics of the data. To define the structure of the hypothesis space, the systems analysts or designers must formalize the concepts (knowledge in an abstract format that can be used to guide a searching or reasoning process) and determine how they are joined to form a hypothesis. The concepts provide clues about the nature of the space such as if it is finite, if a hierarchy must to be considered, if certain levels of abstraction can be applied, and if a specific class of the concept must be generated. Such searching techniques as blind search, heuristic search, and abstracting the solution space are often used. Reasoning techniques such as assumption building, justification building, and the constraints and goal technique help to identify the underlying model of the process used to generate solutions in the domain. 4. System design phase During the system design phase (sometimes called the logical design phase) the analyst and/or designer specifies how the system will meet the requirements identified during the previous three phases. Typically, the reports and other outputs the systems must produce are defined first. This phase is similar to the design stage in the traditional systems development life cycle. Note, however, that the representation schemes used to describe knowledge differ from traditional methodologies. Using the knowledge, you have acquired and the tool you have selected, you can now begin the design of the expert system. First, you will need to create an outline, a hierarchal flow chart, a matrix, decision table, or other format that will help you organize and understand the knowledge. Using these aids, you will convert the knowledge in to IFTHEN rules. It is best to follow the specific procedures recommended by the software tool you are using. Once the basic design is complete, you can begin using the tool to create a prototype of one segment of the system. Translate a portion of the knowledge into rules and test the newly created segment. Test the concept before going ahead with the entire program. 5. System development phase A prototype expert system is created during the system development (or physical design) stage. This stage is similar to the development stage in the traditional system development life cycle. Once you have satisfied yourself that the system is going to work satisfactorily, now you can begin to expand the prototype into the final system. The best way to go about this is to expand the prototype one segment at a time. 6. Testing and evaluation phase During this phase, the prototype system is evaluated. This phase parallels the testing stage in the traditional system development life cycle. However, in addition to the testing tools and techniques, expert systems utilize a dynamic testing technique to verify the reasoning and/or inference process. After the expert system has been developed, you will need to spend some time to testing and debugging it. No expert system will be perfect the first time, and a considerable amount of work will be required to validate it. User feedback will show you where to make final changes, corrections, and additions to achieve the desired performance. 7. Prototype revision phase An expert system evolves over time, calling for almost constant revision, a trait expert systems share with most prototypes. Based on the results of the testing/evaluation phase, concepts and relations are refined, the solution space, the model, the data characteristics are re-formalized, and the system is redesigned. 8. Maintain the System An important part of expert system development is ongoing maintenance, updating the system with new knowledge, removing knowledge that is no longer applicable, and otherwise fine tuning the system to keep it fully current and applicable to the problem. Module 3: The Need for Expert Systems & Applications 3.1 Why Expert Systems? 3.2 Human Expert Limitations, Consistency, Efficiency 3.3 Cost Savings in Expert System Implementation 3.4 Applications of Expert Systems 3.0 Introduction Expert systems are a branch of artificial intelligence that mimic human expertise in specific fields to solve complex problems. In computer science, these systems are essential as they provide reliable decision-making support, enhance productivity, and enable the automation of specialized tasks that would otherwise require expert human intervention. 3.1. Why Expert Systems? 1. Consistency and Reliability: Expert systems can replicate the knowledge and decisions of human experts consistently, without the variability of human mood or fatigue. This quality ensures dependable, repeatable results crucial for high-stakes industries like healthcare, finance, and engineering. 2. Accessibility to Expertise: These systems democratize access to specialized knowledge, allowing non-experts to make informed decisions. By using expert systems, organizations can save on training costs and quickly equip employees with a tool that replicates advanced decision-making capabilities. 3. Improved Efficiency and Speed: In scenarios requiring rapid decision-making, expert systems streamline operations by analyzing vast amounts of data faster than a human expert could. This accelerates processes and helps organizations remain competitive in fast-paced environments. 4. Knowledge Preservation: As expert systems are programmed with the knowledge of experienced professionals, they preserve this expertise even when the human experts retire or leave the organization. This aspect is vital for maintaining continuity in sectors where expert knowledge is rare or difficult to replace. 5. Adaptability: Modern expert systems can learn and adapt over time, improving their decision-making capabilities as they interact with new data. This adaptability is especially valuable in fields like diagnostics and risk management, where conditions can frequently change. In summary, expert systems bring immense value to computer science by allowing complex problem-solving and decision-making to be performed consistently, accurately, and at scale, bridging the gap between human expertise and technology. 3.2 Human Expert Limitations, Consistency, Efficiency The adoption of expert systems addresses several limitations of human experts, as well as issues of consistency and efficiency in problem-solving. Understanding these areas is import as they provide knowledge of why expert systems are essential and how they enhance human work in various fields. 3.2.1 Human Expert Limitations Despite their expertise, human professionals often face limitations that affect their performance and decision-making. These limitations can include memory constraints, fatigue, emotional influences, and the finite nature of human working hours. Here are some key aspects: Memory Constraints: Humans can only retain a limited amount of information at any time. Experts might forget critical details or fail to recall them under pressure, leading to suboptimal decisions. Fatigue and Burnout: Prolonged work can lead to mental fatigue, resulting in slower responses, increased error rates, and potentially risky decisions. Availability: Human experts are often not available 24/7. This is particularly critical in fields that require immediate responses, such as healthcare or emergency services. Example: In medical diagnosis, a doctor can only handle a certain number of patients per day. Fatigue may lead to misdiagnoses or overlooked symptoms, which could potentially be mitigated by a medical expert system that operates with consistency, 24/7. 3.2.2 Consistency Consistency refers to the ability to provide uniform decisions and advice under similar conditions. Human experts may vary in their decisions based on several external and internal factors, such as mood, stress, or personal biases. Expert systems, however, are programmed to maintain consistency across all instances, providing uniform responses under the same set of conditions. Lack of Bias: Expert systems, unlike human experts, can be programmed to remain objective, reducing personal biases that may affect decision-making. Reproducibility: Expert systems can reproduce the same advice or decision every time, given the same input data. This reproducibility is crucial in domains where standardized responses are essential for quality control. Reduced Human Error: The risk of variability due to human error is minimized, allowing for more predictable outcomes. Example: In legal advisory systems, human lawyers might interpret laws differently based on personal understanding or local practices. An expert system designed to provide legal advice would apply the law consistently and avoid personal interpretations, which is valuable in ensuring equal treatment and advice across all cases. 3.2.3 Efficiency Efficiency in expert systems means the ability to provide fast, accurate, and reliable decisions. While human experts can be highly skilled, they are often limited by time and cognitive capacity, impacting their overall efficiency. Speed: Expert systems can process vast amounts of data much faster than a human can. This is particularly beneficial in fields like finance, where real-time decision-making is essential. Cost-effectiveness: Expert systems reduce the need for multiple human experts, lowering operational costs in the long run. They can handle repetitive and high-volume tasks without the need for rest or compensation. Scalability: Once developed, expert systems can be deployed widely, handling hundreds or thousands of cases simultaneously, which is not feasible for human experts. Example: In stock market trading, human analysts are limited by how much information they can process in real time. An expert system for trading can monitor and analyze global stock data continuously, executing trades based on predefined strategies within milliseconds, enhancing both speed and efficiency. 3.3 Cost Savings in Expert System Implementation Cost savings are one of the significant advantages of implementing expert systems. By leveraging expert knowledge without the constant need for human intervention, organizations can reduce expenses, improve efficiency, and maintain consistent decision-making. 3.3.1 Key Cost Savings from Expert Systems Implementation 1. Reduction in Operational Costs Expert systems streamline repetitive and rule-based tasks, reducing the need for manual intervention and human labor. For example, an expert system can perform routine medical diagnoses or financial assessments, which would otherwise require skilled professionals. By automating these processes, organizations can save on salaries, training, and overhead expenses associated with maintaining large human teams. Example: In banking, credit scoring expert systems assess loan applications faster and more consistently than human analysts. This reduces the cost of hiring a large team of credit analysts, while increasing accuracy and speed. 2. Improved Efficiency and Productivity Expert systems enhance productivity by reducing the time spent on decision-making and analysis. By delivering expert-level insights instantly, organizations save time and can process more cases or tasks in a shorter period, leading to higher productivity and lower per-unit operational costs. Example: In the airline industry, expert systems like those used in aircraft maintenance scheduling predict optimal times for repairs and replacements, avoiding expensive unscheduled maintenance. This proactive maintenance helps prevent costly downtime and service delays. 3. Minimized Errors and Rework Expert systems use consistent rules to make decisions, which minimizes human error due to fatigue, bias, or oversight. The reduction in error rates can lead to substantial cost savings, especially in fields where mistakes are costly or dangerous, such as healthcare or finance. Less rework means reduced materials, labor, and resources needed to correct errors. 4. Training and Knowledge Transfer Costs Training new employees to reach expert levels in complex fields is costly and time-consuming. Expert systems retain and share knowledge effectively, which reduces the training burden. When experts retire or leave, the system preserves their knowledge, eliminating the need to constantly replace expertise. 5. Scalability and Reduced Incremental Cost of Operations Once developed, expert systems can scale without significant additional costs. Scaling human resources, by contrast, incurs higher expenses. Expert systems can handle increasing demand without major upgrades, meaning organizations can grow their operations affordably. Example: Amazon’s recommendation system uses AI and expert algorithms to provide personalized recommendations to millions of users. Instead of hiring a vast team to manage recommendations manually, the system scales efficiently as demand grows. 6. Cost Avoidance Through Predictive Maintenance and Early Problem Detection In industrial and manufacturing sectors, predictive maintenance expert systems help identify equipment that may fail, allowing organizations to schedule repairs before breakdowns occur. This avoids costly emergency repairs and prevents production downtime. Example: General Electric (GE) uses an expert system to monitor and predict failures in its turbines and engines. This predictive maintenance approach saves millions by reducing unscheduled downtime and extending the life of equipment. 7. Reduced Dependence on Specialized Expertise Expert systems allow organizations to make high-level decisions without always requiring specialized human experts on hand. This is particularly useful in industries where experts are scarce or expensive. By encoding their knowledge into systems, organizations can reduce dependency on scarce resources and manage costs effectively. 8. Cost Savings in R&D and Innovation In research and development, expert systems help simulate and model scenarios that would otherwise require extensive trials, reducing the time and resources spent on testing. In fields such as pharmaceuticals, where trials are expensive, expert systems aid in drug discovery and testing. 3.3.2 Implementation Challenges and Considerations While expert systems offer substantial cost savings, developing and maintaining them can involve significant initial costs. Challenges include: Knowledge Acquisition: Encoding expert knowledge into a system is time-consuming and may require extensive collaboration with domain experts. Maintenance and Updates: Expert systems require regular updates to remain relevant, which incurs ongoing costs. Limitations in Scope: Expert systems excel in narrow domains but may be ineffective in broader, complex scenarios Applications of Expert Systems 1. Medical Diagnosis: Expert systems assist doctors by analyzing symptoms and medical history to suggest possible diagnoses or treatment options. For example, MYCIN, an early expert system, helped identify bacterial infections and recommend antibiotics. 2. Financial Services: In finance, expert systems are used for credit scoring, fraud detection, and investment advice. They analyze financial data and patterns to make informed decisions. 3. Technical Support: Expert systems can troubleshoot and provide solutions for technical issues. They guide users through problem-solving steps based on pre-defined rules and knowledge. 4. Manufacturing: In manufacturing, expert systems help optimize production processes, perform quality control, and manage inventory by analyzing data and making recommendations. 5. Expert System in Education: In the field of education, many of the expert system’s application are embedded inside the Intelligent Tutoring System (ITS) by using techniques from adaptive hypertext and hypermedia. Most of the system usually will assist student in their learning by using adaptation techniques to personalize with the environment prior knowledge of student and student’s ability to learn. Expert system in education has expanded very consistently from microcomputer to web based and agent-based technology. Web based expert system can provide an excellent alternative to private tutoring at any time from any place where internet is provided. Agent based expert system will help users by finding materials from the web based on the user’s profile. 6. Agriculture: Assists in crop management, pest control, and soil analysis, improving yield predictions and resource allocation. 7. Legal Advice: Offers legal information and assists with case analysis, helping lawyers research precedents and evaluate case outcomes. 8. Energy Management: Optimizes energy distribution and consumption, assisting in the management of electrical grids and renewable energy sources. Module 4: Knowledge Representation in Expert Systems 4.1 Introduction to Knowledge Representation 4.2 Rules, Facts, and Procedures in Knowledge Representation 4.3 Knowledge Representation Techniques (Logic-based, Semantic Networks, Frames, and Scripts) 4.4 Knowledge Representation Method 4.1 Introduction to Knowledge Representation Knowledge Representation (KR) is a fundamental area in artificial intelligence (AI) and computer science that deals with how knowledge can be represented and structured for effective use by a machine, especially in decision-making. KR is essential for building expert systems, natural language processing systems, robotics, and other AI applications where machines need to interpret, analyze, and make decisions based on the available data. The primary goal of KR is to translate human knowledge into a form that computers can process to solve complex problems and make informed decisions. To do this, KR involves methods for encoding knowledge about the world and reasoning about that knowledge. 4.1.1 Importance of Knowledge Representation Knowledge representation is essential in computer science for the following reasons: 1. Improving AI Understanding: KR helps AI systems understand the context and nuances of the information they process, enabling more human-like understanding and decision- making. 2. Facilitating Reasoning and Inference: A well-structured representation allows AI systems to reason and make logical inferences, which is crucial in applications like medical diagnosis, law, and financial analysis. 3. Supporting Problem Solving: By organizing knowledge efficiently, KR aids in solving complex problems that require a high level of expertise, as seen in expert systems. 4. Enhancing Human-Computer Interaction: KR can improve how AI systems interact with humans by representing information in ways that are relatable and understandable for humans. 4.1.2 Components of Knowledge Representation 1. Syntax: The set of rules that define the structure of knowledge. This includes grammar, symbols, and rules for combining elements in a way that can be processed by machines. 2. Semantics: The meaning behind the symbols and structures. Semantics allow a machine to understand what the symbols represent, beyond just their form. 3. Pragmatics: The context in which knowledge is used. Pragmatics consider how knowledge should be applied in specific situations or environments. 4. Inference Mechanisms: The processes by which new knowledge can be derived from existing knowledge. Inference mechanisms enable the system to answer questions and solve problems based on the information it already holds. 4.1.3 Applications of Knowledge Representation 1. Medical Expert Systems: In healthcare, expert systems such as Mycin (an early AI system for diagnosing bacterial infections) use production rules and frames to diagnose diseases and recommend treatments. By representing knowledge in logical statements, the system can provide a diagnosis based on symptoms entered by a physician. 2. Autonomous Vehicles: Self-driving cars rely on KR to understand and interpret their surroundings. They use a combination of semantic networks and ontologies to identify and classify objects like pedestrians, vehicles, and traffic signs. This KR allows the vehicle to make safe driving decisions based on the relationships between objects. 3. Customer Support Chatbots: Chatbots use scripts and production rules to provide automated responses to common customer queries. For example, a chatbot might use a script to walk a user through password recovery or troubleshoot a network issue. 4. Natural Language Processing (NLP): Applications like Google Translate use semantic networks to understand and map relationships between words and phrases across languages. By representing the structure and relationships of language, these systems improve the accuracy of translation and comprehension. 4.1.4 Challenges in Knowledge Representation 1. Complexity: Human knowledge can be highly complex and ambiguous, making it challenging to represent in structured forms. 2. Knowledge Acquisition: Gathering the vast amounts of information required for certain applications is often time-consuming and resource-intensive. 3. Scalability: As the amount of knowledge grows, systems need efficient methods for storage, retrieval, and processing. 4. Reasoning Limitations: Certain types of reasoning, such as common-sense reasoning, are difficult to implement in machines, leading to potential errors in judgment or decision- making. 4.2 Rules, Facts, and Procedures in Knowledge Representation 4.2.1 Rules Rules are conditional statements that guide the decision-making processes within expert systems. In knowledge representation, rules take the form of “if-then” statements, where a specific condition must be met (the "if" part) to trigger an action or conclusion (the "then" part). These rules allow the system to reason logically based on predefined scenarios. Example of Rule-Based Knowledge Representation; Consider a simple rule used in a medical diagnosis expert system: Rule: If a patient has a high fever, cough, and shortness of breath, then they might have pneumonia. In this case: Condition (If): High fever, cough, shortness of breath Action (Then): Possible diagnosis of pneumonia Such rules can be combined to create complex reasoning chains. For example, in an AI system used for loan approvals: If income > N50,000 and credit score > 700, then approve loan. Real-World Applications of Rule-Based Systems ❖ Fraud Detection: Banks and credit card companies use rules to flag transactions that may be fraudulent. For instance, “If a transaction amount exceeds N1,000,000 and is made from a new location, then flag for review”. ❖ Customer Support Chatbots: These use rules to respond to user questions. For example, “If a user mentions 'password reset,' then send password reset instructions”. 4.2.2 Facts Facts are statements of truth or specific information that are input into an expert system to describe its environment, situation, or objects of concern. Facts serve as the raw data or foundational knowledge upon which rules can operate. They are typically represented as atomic statements or assertions that the system can use directly without modification. Example of Facts in Knowledge Representation Using the previous medical diagnosis example: Fact 1: The patient has a temperature of 39°C. Fact 2: The patient has been coughing for three days. Fact 3: The patient has a high heart rate. The expert system will use these facts alongside predefined rules to suggest a diagnosis or next steps. Applications of Facts in Expert Systems Weather Prediction Systems: Facts might include temperature, humidity, wind speed, and atmospheric pressure. These facts, combined with meteorological rules, help the system predict the weather. Inventory Management Systems: Facts about stock levels, demand forecasts, and reorder points are used to automate inventory replenishment. For example, "Item A stock = 20" and "Reorder threshold for Item A = 25" may trigger a replenishment order. 4.2.3 Procedures Procedures represent the methods or algorithms by which an expert system processes rules and facts to reach conclusions or make decisions. They involve a series of steps that dictate how the system should combine rules and facts, typically through a reasoning process like forward chaining or backward chaining. Types of Inference Procedures a. Forward Chaining: Starts with facts and applies rules to draw new conclusions or actions until a goal is achieved. It is often used in systems that need to draw conclusions based on available data. Example: In a troubleshooting expert system for technical support, if the system knows that “the computer does not turn on,” it will forward chain through possible causes until a solution is suggested, such as “Check power supply”. b. Backward Chaining: Starts with a potential goal or hypothesis and works backward to see if there are facts and rules that support it. It is commonly used in diagnostic systems. Example: In a medical diagnosis system, if a doctor suspects pneumonia, the system can work backward by checking if the conditions (high fever, cough, shortness of breath) are present. Applications of Procedures in Expert Systems Loan Approval Systems: Banks often use backward chaining procedures to approve or reject loans based on whether applicants meet specific criteria (e.g., income, credit score, employment status). Legal Expert Systems: Legal AI systems use procedures to evaluate evidence against a set of laws and regulations, supporting attorneys in case preparation by simulating legal reasoning. 4.2.4 Summary In an expert system, rules, facts, and procedures work in tandem (together) to create a framework that resembles human reasoning. Let’s take an example of an agricultural expert system for pest control: Facts: Crop type = “Tomato,” Pest = “Aphids,” Weather = “Warm and Humid” Rule: If crop is “Tomato” and pest is “Aphids” and weather is “Warm and Humid,” then recommend “Neem oil treatment”. Procedure: Use forward chaining to determine appropriate pest control strategies based on crops, pests, and environmental conditions. Here, the system applies the rule to facts using the forward-chaining procedure to recommend “Neem oil treatment,” as an effective method for controlling aphids in tomatoes under these conditions. Rules: Direct "if-then" logic used to make decisions (e.g., loan approvals, medical diagnoses). Facts: Raw data or information, such as a patient's symptoms or environmental conditions. Procedures: Methods guiding the application of rules to facts, using inference mechanisms like forward or backward chaining. 4.3 Knowledge Representation Techniques 1. Logical Representation Logical representation involves using formal logic (like propositional or predicate logic) to express knowledge. In this technique, statements about facts and rules are represented as logical expressions or formulas. Logical representation is highly structured and allows inference through logical operations. Propositional Logic: Deals with simple declarative statements that are either true or false. For example, "If it rains, then the ground is wet." Predicate Logic: Extends propositional logic by adding variables and quantifiers to describe relationships more complexly. For example, "If John is a doctor, then John can treat patients." Example: In medical expert systems, logical representation might be used to represent symptoms and diagnoses: If (Fever AND Cough) => Diagnosis = Flu 2. Semantic Networks Semantic networks represent knowledge as a network of nodes connected by links. Each node represents a concept (such as an object or a property), and each link represents a relationship between two nodes. Semantic networks are often used to represent hierarchical knowledge, where certain concepts are subclasses of others. Example: Consider a travel recommendation expert system that suggests activities based on weather, location, and traveler preference. A semantic network can represent concepts like: Destination → “Beach” Weather → “Sunny” Activity → “Surfing” Using relationships like “has location” and “has activity,” a semantic network can connect these concepts, helping the system make relevant activity recommendations based on destination and weather. 3. Frames Frames are data structures used to represent stereotyped situations, containing attributes (slots) and values (fillers). Frames allow for organized knowledge storage by bundling attributes related to an object into a single structure. This technique can support inheritance, where a frame can inherit attributes from a parent frame, allowing for efficient and organized knowledge representation. Example: In a car manufacturing expert system, a frame might represent a specific car model with slots like: Model: Sedan Engine Type: Hybrid Max Speed: 180 km/h Frames enable the system to answer questions about a specific model based on this structured information. 4. Production Rules Production rules are "if-then" statements that represent procedural knowledge. Each rule consists of a condition (if) and an action (then). Production rules are commonly used in rule-based expert systems, where the system applies rules to infer knowledge or make decisions. Forward Chaining: Starts with available data and applies rules to infer conclusions. Backward Chaining: Starts with a goal and works backward to determine which rules and data support the goal. Example: In a customer service chatbot, production rules might look like: If (Customer has a question about product warranty) Then (Direct customer to warranty FAQ page) 5. Scripts Scripts are a type of structured representation for capturing knowledge about sequences of events or actions in specific situations. They are especially useful for understanding processes and routines, making them effective for systems that need to handle predictable, sequential tasks. Example: In a hospitality expert system that assists hotel front-desk agents, a script could represent the check-in process: Steps like “Greet Guest,” “Check Reservation,” “Assign Room,” “Hand Over Key,” are structured to follow the usual process, ensuring consistent guest interactions. 6. Object-Oriented Representation This method uses objects (data structures that encapsulate both attributes and behaviors) to represent knowledge. Object-oriented knowledge representation allows for inheritance, encapsulation, and polymorphism, making it ideal for complex systems with a diverse range of data and operations. Example: In a warehouse management system, objects can represent different types of goods, each with attributes like weight, dimensions, and storage conditions. A “PerishableItem” object could inherit common properties from a “Goods” object and add specific attributes like expiration date, storage temperature, etc. 7. Ontologies Ontologies offer a structured and standardized way to represent complex knowledge domains by defining the entities involved and their relationships. Ontologies provide a shared vocabulary and a hierarchical structure, making them ideal for interoperability across systems. Example: In healthcare, an ontology-based expert system might use a medical ontology like SNOMED CT (Systematized Nomenclature of Medicine—Clinical Terms) to standardize terms for symptoms, diseases, and treatments, enabling precise data sharing and inference. Applications of Knowledge Representation Medical Diagnosis Systems: Knowledge representation is essential in expert systems that assist doctors by analyzing symptoms, recommending tests, and suggesting possible diagnoses. For instance, production rules can identify conditions based on symptoms, while ontologies standardize medical terms. Financial Advisory Systems: Expert systems in finance use logical representation and production rules to assess risk levels, recommend investments, and manage portfolios based on market conditions and investor profiles. Customer Service Chatbots: Many modern chatbots use production rules to answer frequently asked questions and assist customers. Semantic networks may represent the relationship between products, services, and support topics. Self-Driving Cars: These systems use object-oriented representation to handle various road entities (vehicles, pedestrians, traffic signals) and apply rules and scripts for safe navigation. 4.4 Knowledge Representation Methods Knowledge is represented by three methods in expert system; these are: i. Production Rules ii. Semantic Net iii. Frames and Logic I. Production Rules or Production System: Rules are used to represent relationships. Rule-based knowledge representation employs IF condition (premise or consequent) THEN action (goal or antecedent) statements. For example, IF the heating element glows AND the bread is always dark THEN the toaster thermostat is broken When the problem situation matches the IF part of a rule, the action specified by the THEN part of the rule is performed Production rules are one of the most popular and widely used knowledge representation languages and production rule system consists of three components: i. Working memory contains the information that the system has gained about the problem thus far. ii. Rule base contains information that applies to all the problems that the system may be asked to solve. iii. Interpreter solves the control problem, i.e., decide which rule to execute on each selection - execute cycle. Advantages of Production System rule method: a. Naturalness of expression b. Modularity c. Restricted syntax d. Ability to Represent Uncertain Knowledge Disadvantages of Production System: a. Inefficient b. Less expressive II. Semantic Net It is formalism/mechanism for representing information /Knowledge about objects, people, concepts and specific relationship between them. The syntax of semantic net is simple. It is a network of labeled nodes and links. It is a directed graph with nodes corresponding to concepts, facts, objects etc. and arcs showing relation or association between two concepts. The commonly used links in semantic net are of the following types. isa → subclass of entity (e.g., child hospital is subclass of hospital) inst → particular instance of a class (e.g., India is an instance of country) prop → property link (e.g., property of dog is „bark) Representation of Knowledge in Semantic Net Every human, animal and bird are living things that breathe and eat. All birds can fly. All man and woman are humans who have two legs. Cat is an animal and has a fur. All animals have skin and can move. Giraffe is an animal who is tall and has long legs. Parrot is a bird and is green in color Inheritance in Semantic Net Inheritance mechanism allows knowledge to be stored at the highest possible level of abstraction which reduces the size of knowledge base. i. It facilitates inference of information associated with semantic nets. ii. It is a natural tool for representing taxonomically structured information and ensures that all the members and sub-concepts of a concept share common properties. iii. It also helps us to maintain the consistency of the knowledge base by adding new concepts and members of existing ones. Advantages of Semantic nets i. Easy to visualize ii. Formal definitions of semantic networks have been developed iii. Related knowledge is easily clustered. iv. Efficient in space requirements v. Objects represented only once vi. Relationships handled by pointers Disadvantages of Semantic nets i. Inheritance (particularly from multiple sources and when exceptions in inheritance are wanted) can cause problems. ii. Facts placed inappropriately cause problems. iii. No standards about node and arc values III. Frame Frame is a semantic net with properties, it represents general concept or specific entry. Frames represent objects as sets of slot/filler pairs, and this object can contain programs as well as data (if-needed, if-added, if-removed). The utility of frames lies in hierarchical frame system and inheritance, this makes it easy to construct and manipulate a complex knowledge base. Frames are implicitly associated with one another because value of a slot can be another frame. There are three components of a frame: a) Frame name b) Attributes (slots) c) Values (Fillers) Fillers can be links to other frames Advantages i. Domain knowledge model reflected directly ii. Support default reasoning iii. Efficient iv. Support procedural knowledge Disadvantages i. Lack of semantics ii. Expressive limitations 4.4.1 Overview of Natural Language interface for Expert Systems A Natural Language Interface (NLI) allows users to interact with computers using human languages like English instead of technical commands or graphical interfaces. NLIs accept written or spoken inputs, often limited to specific domains, and typically provide pre-formulated responses. Critics argue that requiring users to adapt to restricted language subsets makes NLIs less effective, advocating for designs that emulate natural turn-taking in human conversations. The first NLI, ELIZA, developed in 1966 by Joseph Weizenbaum, used simple keyword parsing to respond to user inputs but lacked the ability to sustain meaningful conversations. Despite its simplicity, ELIZA marked a significant milestone in human-computer interaction. Natural language can be processed by computers through speech recognition, speech synthesis, text-based pattern matching or gesture interaction. Speech recognition: has come of age in recent years but has not matured to an extent that it can be utilized to have a conversation with a computer. Most speech recognition systems are restricted to certain keywords within a domain and, therefore cannot be utilized for accomplishing tasks outside a particular domain (Dusan and Flanagan 2004). Furthermore, these systems do not adequately cover all utterances a user might utilize in order to accomplish a task in a certain domain. Research in the area of natural language processing is moving towards the creation of systems that are capable of learning human knowledge and obtaining related knowledge as a conversation proceeds (Dusan et al. 2004). Speech synthesis: is the process of outputting simulated human speech. Speech utilized in human language. When the sounds are grouped together the actual process of understanding user input is initiated. Over the years, many approaches have been utilized but only two will be discussed here namely pattern matching and knowledge-based approaches. These two approaches are not mutually exclusive and are discussed below: Pattern matching: The goal of pattern matching is to take an unknown pattern and compare it to a set of known and stored patterns (also known as templates). These are established through training data. Templates are utilized to compare the pattern and compute a similarity score (Zue et al. 2000; Schroeder 2004). The template with the highest score is then chosen as it will have the highest acoustic similarity to the users input. Knowledge-based approaches: This approach makes use of a rule-based expert system which utilizes a base classification of rules in order to function. However to utilize this model, a large set of rules would be needed in order to capture a great variability in speech. Rules are formed from knowledge about speech signals. This approach could be useful, however, it does not perform effectively if there is insufficient knowledge. 4.4.2 Speech Synthesis Speech synthesis enables computers and other electronic devices to output simulated human speech. A computer system that is utilized for the purpose of producing human speech is known as a speech synthesizer. A text-to-speech (TTS) system is an example of a speech synthesizer that converts normal text into speech. The quality and effectiveness of speech produced by these systems are measured by utilizing these characteristics: ❖ Base-level achievement of speech that is intelligible (the ease with which the output is understood) to humans; ❖ produce speech that is as natural as that of human beings in other words how natural the speech is; ❖ produce speech that is personalized to a particular user, in other words it has the same intonation as a person’s speech; and ❖ the final level and highest level of achievement is to produce speech based on a person’s own voice recordings so that the speech sounds as if it belongs to that person. For a text-to-speech system to function, a narrator is utilized to record a series of text (such as reading from an encyclopedia, poetry, political news and various other texts). A text-to-speech (TTS) system works by recording a narrator reading diverse texts to capture all possible sounds of a language. These recordings are segmented into phonemes, syllables, and larger linguistic units, stored in a database. The system’s backend processes this data, while the frontend handles text normalization (expanding abbreviations and symbols) and converts text to phonemes. These phonemes are then synthesized into speech. TTS systems use two main methods: concatenated synthesis, which assembles pre-recorded voice segments, and formant synthesis, which generates speech using rule-based algorithms, simulating sounds without pre-recorded voices. 4.4.3 Text-Based Natural Language Interfaces Text-based NLIs utilize text instead of speech in order to function. Text may be in the form of a query, sentence or a list of keywords (as used by search engines). A user will type in a question in an appropriate field (usually a textbox) and the system will retrieve information in accordance to the user’s query. Text-based natural language interfaces have been utilized in many applications including: databases (query and report generation), conversational agents and search engines (matching user requests to keywords). Conversational agents are a communication technology that utilizes natural language and various linguistic methods to interact with human users through natural language. Conversational agents need to satisfy two sets of requirements for them to be effective (Lester et al. 2004): ❖ they must have good language processing capabilities such that they have the ability to engage in productive conversations with the user. This involves understanding user input and employing effective dialogue management techniques; and ❖ they must be scalable and reliable and allow for smooth integration within business processes. Conversational agents, initially popular on retail websites for customer inquiries, have expanded into domains like education, banking, and travel. They are also effective in virtual text-based environments, such as social platforms like Second Life. For instance, the conversational agent ALICE uses pattern-matching techniques and Artificial Intelligence Markup Language (AIML) to interact with users. Text-based agents typically use two key methods for understanding input: 1. Pattern Matching: Matches user input to predefined patterns to generate responses, though it struggles with maintaining context or handling varied inputs. 2. Bayesian Networks: Uses probabilistic models to maintain conversation context by predicting the next likely response based on prior interactions. 4.4.4 Shortcomings of Natural Language Interfaces (NLIs) While NLIs initially seemed promising, experts in human-computer interaction highlight their limitations in helping users’ complete tasks effectively. These challenges stem from the inherent ambiguity of natural language and the need for extensive knowledge repositories. For example, consider the statement: "At last, a computer that understands you like your mother." This sentence can be interpreted in multiple ways: 1. The computer understands you as well as your mother does. 2. The computer understands that you like your mother. 3. The computer understands you as well as it understands your mother. Such ambiguity illustrates the difficulty in accurately interpreting human language, making NLIs less reliable than expected. Module 5: Rule-Based Expert Systems 5.1 Introduction to Rule-Based Expert Systems 5.2 MYCIN- as an example of Rule Based Expert System 5.3 If-Then Rules, Forward and Backward Chaining 5.4 Building a Simple Rule-Based Expert System 5.1 Introduction to Rule-Based Expert System This is the earliest type of expert systems and the most common way for researchers to build expert system. The expert system, which is completed by production rules, has been integrated into various research areas to help researchers solve all kinds of problems with pre-input knowledge. Most expert systems are rule-based, rule-based is an expert system based on a set of rules that a human expert would follow in diagnosing a problem. Such systems are commonly employed in fields like medicine, finance, engineering, and troubleshooting applications where a high level of expertise is essential. The structure of a rule-based expert system is shown in diagram below. The developer interface usually includes knowledge base editors, debugging aids and input/output facilities. All expert system shells provide a simple text editor to input and modify rules, and to check their correct format and spelling. Fig. 5.1 Showing the complete structure of a rule-based expert system 5.1.1 Components of a Rule-Based Expert System 1. Knowledge Base: Contains facts and rules. Facts are pieces of data or information, and rules are "if-then" statements that represent domain expertise. 2. Inference Engine: Evaluates the facts against the rules to infer new facts or draw conclusions. 3. User Interface: Allows the user to interact with the system by entering data and receiving insights or answers. 4. Explanation Facility: Explains the system’s reasoning and conclusions to users, enhancing transparency and trust. 5.1.2 How Rule-Based Expert Systems Work Rule-based expert systems operate by matching facts in the knowledge base against rules. When facts satisfy a rule's conditions, the rule is triggered, and the corresponding action is taken. For example: Rule: IF a patient has a high fever AND rash THEN recommend checking for measles. Fact: A patient has a high fever and a rash. The inference engine matches the fact to the rule, infers a new fact, and recommends checking for measles. 5.1.3 Practical Examples of Rule-Based Expert Systems operates 1. Medical Diagnosis: An expert system might diagnose diseases based on symptoms. For instance, the system could have rules like: ❖ IF cough AND fever AND sore throat THEN diagnose flu. ❖ IF rash AND high fever THEN diagnose measles. 2. Troubleshooting Systems: Used in technical support to diagnose issues with equipment. ❖ IF device won't turn on AND power supply is connected THEN check battery. ❖ IF device turns on AND display is blank THEN check display settings. 3. Loan Approval: In banking, expert systems can assess loan eligibility. ❖ IF income > $50,000 AND credit score > 700 THEN approve loan. ❖ IF income < $30,000 OR credit score < 600 THEN decline loan. 5.1.4 Which features make rule-based expert systems particularly attractive for knowledge engineers? Among these features are: 1. Natural knowledge representation. An expert usually explains the problem-solving procedure with such expressions as this: „In such-and-such situation, I do so-and-so‟. These expressions can be represented quite naturally as IF-THEN production rules. 2. Uniform structure. Production rules have the uniform IF-THEN structure. Each rule is an independent piece of knowledge. The very syntax of production rules enables them to be self- documented. 3. Separation of knowledge from its processing. The structure of a rule-based expert system provides an effective separation of the knowledge base from the inference engine. This makes it possible to develop different applications using the same expert system shell. It also allows a graceful and easy expansion of the expert system. To make the system smarter, a knowledge engineer simply adds some rules to the knowledge base without intervening in the control structure. 4. Dealing with incomplete and uncertain knowledge. Most rule-based expert systems are capable of representing and reasoning with incomplete and uncertain knowledge. 5.1.5 Rule-based expert systems challenges There are three main shortcomings: 1. Opaque relations between rules. Although the individual production rules tend to be relatively simple and self-documented, their logical interactions within the large set of rules may be opaque. Rule-based systems make it difficult to observe how individual rules serve the overall strategy. This problem is related to the lack of hierarchical knowledge representation in the rule-based expert systems. 2. Ineffective search strategy. The inference engine applies an exhaustive search through all the production rules during each cycle. Expert systems with a large set of rules (over 100 rules) can be slow, and thus large rule-based systems can be unsuitable for real-time applications. 3. Inability to learn. In general, rule-based expert systems do not have an ability to learn from the experience. Unlike a human expert, who knows when to „break the rules‟, an expert system cannot automatically modify its knowledge base, or adjust existing rules or add new ones. The knowledge engineer is still responsible for revising and maintaining the system. 5.2 MYCIN- as an example of Rule Based Expert System It is the name of a decision support system developed by Stanford University in the early- to mid- seventies, built to assist physicians in the diagnosis of infectious diseases. The system (also known as an “expert system”) would ask a series of questions designed to emulate the thinking of an expert in the field of infectious disease, and from the responses to these questions give a list of possible diagnoses, with probability, as well as recommend treatment (hence the “decision support”). The name "MYCIN" actually comes from antibiotics, many of which have the suffix “mycin”. The framework for MYCIN was derived from an earlier expert system called DENDRAL, created to find new chemical compounds in the field of organic chemistry (also developed at Stanford). MYCIN is an expert system comprised of two major components: 1. A knowledge base which stores the information the expert system “knows”, much of which is derived from other information in the knowledge base. 2. An inference engine to derive knowledge from the presently known knowledge in the knowledge base. Figure 5.2 Component of MYCIN system Knowledge represented by MYCIN's knowledge base is represented as a set of IF-THEN rules with particular certainty factors. For example: IF the infection is primary-bacteremia AND the site of the culture is one of the sterile sites AND the suspected portal of entry is the gastrointestinal tract THEN there is suggestive evidence (0.7) that the infection is bacteroid Humans interface with MYCIN by answering a series of diagnostic questions akin to what a physician may ask a patient, as well as prompting for relevant test results. MYCIN takes this data as input and either arrives at a set of answers with respective probabilities, or branches to other questions in order to narro it's search. Researchers at Stanford found MYCIN to have an approximate correctness rate of 65%, which is better than the majority of physicians who are not specialists in diagnosing infections, and only slightly worse than physicians who were experts in that field (who had an average correctness of approximately 80%). A. Mycin's knowledge base It is small relative to those used by most rules-based systems today; it is on the order of ~500 rules. The science of the generation of these rules is known as "knowledge engineering". MYCIN uses a modification of the method of reasoning called "backward chaning" to search it's knowledge base. The modification comes in when the system is in the beginning stages of diagnosis, when the system asks a series of broad questions in order to weed out any unnecessary searches later on, such as checking for pregnancy if the patient is male. Only when the problem becomes more defined does MYCIN use full backwards chaining. If MYCIN checks a rule with a probability of 0.2 or less, it will abandon further searching on that particular rule. B. The Inference Engine The core of MYCIN, its inference engine, is called EMYCIN ("Essential MYCIN"). EMYCIN is the framework for MYCIN, a semi-separate system which could be used to create other rules- based expert systems to face problems similar to what MYCIN faces. In some cases this can be affected merely by changing the knowledge base. 5.3 If-Then Rules, Forward and Backward Chaining If-Then Rules: The basic structure of rule-based expert systems consists of "if-then" rules. For example: If a car won’t start, and the battery voltage is low, then suggest recharging or replacing the battery. Each "if-then" statement links conditions to actions or conclusions. Forward Chaining: Forward chaining is a data-driven approach where the system starts with known facts and applies rules to deduce new facts until a goal is reached. Example of Forward Chaining: Consider a health diagnosis system where we have the following rules: 1. If a person has a fever and headache, then it might be the flu. 2. If a person has a sore throat and fever, then it could be a throat infection. Backward Chaining: Backward chaining is goal-driven. The system begins with a hypothesis (goal) and works backward to determine if the available facts support it by confirming each condition in the rules leading up to the hypothesis. Example of Backward Chaining: For the same health diagnosis system, if we want to determine if the flu is the cause, the system will look for evidence of a fever and headache. If both are true, it confirms flu as a probable diagnosis. Difference between Forward and Backward Chaining 5.3 Building a Simple Rule-Based Expert System A basic rule-based expert system in Python that helps diagnose a car’s starting issue. Step 1: Define the Knowledge Base (Rules) We’ll create a set of "if-then" rules. rules = [ {"if": {"battery": "low"}, "then": "Check battery and recharge or replace it."}, {"if": {"battery": "good", "fuel": "empty"}, "then": "Refill fuel."}, {"if": {"battery": "good", "fuel": "full", "spark_plug": "faulty"}, "then": "Replace spark plug."}, {"if": {"battery": "good", "fuel": "full", "spark_plug": "good"}, "then": "Engine might have a more serious issue. Seek professional help."} ] Step 2: Input Facts We collect data from the user as facts. facts = { "battery": "good", "fuel": "full", "spark_plug": "faulty" } Step 3: Create the Inference Engine The engine evaluates the rules based on the input facts. def inference_engine(rules, facts): for rule in rules: if all(facts.get(key) == value for key, value in rule["if"].items()): return rule["then"] return "No solution found. Please check all inputs." Step 4: Run the Expert System # Running the system with the example facts result = inference_engine(rules, facts) print(result) # Expected Output: "Replace spark plug." Module 6: Frame-Based Expert Systems 6.1 Understanding Frames in Expert Systems 6.2 Frame Representation and Use Cases 6.3 Comparing Frame-Based and Rule-Based Expert Systems 6.4 Advantages and Disadvantages 6.1 Understanding Frames in Expert Systems A frame-based expert system organizes information about objects or concepts in a structured way using "frames." Frames, introduced by Marvin Minsky in the 1970s, are data structures that describe an object or concept, with each frame containing "slots" that hold attributes and values. For instance, a "Person" frame might have slots like name, age, height, and weight, while a "Computer" frame might have model, processor, memory, and price as slots. Each slot has a value that describes a specific attribute of the object, and it may also include rules, default values, or links to other frames. This organization allows for a clear, object-oriented way of representing knowledge, making it easy to structure and retrieve information. Frame systems consist of multiple interconnected frames, allowing them to represent domain knowledge in a way that includes handling expectations and responding when they are not met. 6.1.1 What is a Frame? A frame is a data structure used to represent knowledge in artificial intelligence (AI). It stores information about objects, events, or situations in a structured way, similar to a template or a data schema. Frames group related information together, making it easy to organize and access specific knowledge within an expert system. 6.1.2 Purpose of Frames in Expert Systems Frames are used to store and retrieve knowledge efficiently. Unlike rule-based systems, which rely heavily on if-then statements, frames capture the static knowledge of an object or situation, enabling the system to retrieve information in a more structured and meaningful way. Frames are beneficial in: Representing knowledge about objects, concepts, or situations. Reducing redundancy by grouping related information. Facilitating inheritance, where frames can inherit attributes from other frames. 6.1.3 Structure of a Frame A frame typically contains the following elements: Frame Name: The identifier for the frame (e.g., "Car"). slots (fields) that represent attributes of an object or concept. Each slot may contain: Values (specific data or values) Procedures (actions or calculations) Conditions (rules that determine when the slot should be used) Inheritance: Frames can inherit attributes from "parent" frames. For example, a "Sedan" frame could inherit general properties from a "Car" frame, such as "has four wheels" and "uses gasoline." Example of a Frame Here’s an example frame structure for a "Car" frame: Slot: Brand = "Toyota" Slot: Model = "Corolla" Slot: Year = 2019 Slot: FuelType = "Petrol" Slot: Color = "Red" Slot: EngineCapacity = "1.8L" Slot: Procedure (StartEngine) = [procedure to start the car] Each slot can either have a default value (predefined) or be filled dynamically based on user input or other conditions. 6.2 Frame Representation and Use Cases A. Frame Representation Frames are represented in a hierarchical or network structure. Frames with similar attributes can be organized into categories or subcategories, with child frames inheriting the properties of parent frames. In programming terms, frames can be implemented using classes and objects (in languages like Python) or structures (in languages like C). The structure helps to simplify the coding process, making knowledge representation more organized and reusable. B. Use Cases of Frame-Based Systems Frame-based systems are used in domains that require the organization of large amounts of structured knowledge, such as: 1. Medical Diagnosis: Frames can represent symptoms, diseases, treatments, and patient information, enabling systems to make diagnostic suggestions. 2. Vehicle Maintenance: Frames representing parts of a vehicle, their functions, and diagnostic information can help in troubleshooting vehicle issues. 3. Natural Language Understanding: Frames can represent grammatical structures, vocabulary, and syntax, aiding systems in understanding and processing language. 4. Customer Support: Frames can capture common issues, solutions, and knowledge about products to assist in automated customer service. Example: Medical Diagnosis Frame Here’s a simplified example of a medical frame for the diagnosis of "Flu": 6.3 Comparing Frame-Based and Rule-Based Expert Systems Frame-based and rule-based expert systems are two of the main types of knowledge representation in expert systems. Here's a comparison: Example of a Rule-Based Expert System vs. a Frame-Based Expert System ❖ Frame-Based: In a medical expert system, a frame for a "Cold" could store attributes like symptoms, severity, and treatment, making it easy to retrieve all related information in one structure. ❖ Rule-Based: In a medical expert system, diagnosing a "Cold" might involve rules like: If temperature < 101°F and symptoms include "sneezing" and "runny nose," then diagnose "Cold." 6.4 Advantages and Disadvantages of Frame-Based Expert Systems Advantages 1. Efficient Organization: Frames allow for organized storage of knowledge, reducing redundancy and facilitating quick access. 2. Hierarchical Structure: Inheritance allows for complex relationships and subclassing, which is especially useful in large knowledge domains. 3. Readability: Frames provide a clear and understandable structure, making it easier for users and developers to grasp knowledge representation. 4. Reusability: Frame-based systems make it possible to create templates that can be reused across similar object

Use Quizgecko on...
Browser
Browser