Lecture 8: Expert system shells Building expert systems If one wishes to build an expert system, one has several choices of software tool: (1) conventional programming languages (e.g. Pascal, C++, Java) (2) artificial intelligence programming languages (particularly LISP and Prolog) (3) expert system shells Building expert systems The first choice is almost certainly a bad idea. Conventional programming languages are not designed for this sort of job, and too much work is required to make the program perform in the way required. However, if it is important to have highly efficient software, this might be a suitable choice. Building expert systems Choice (2) has the advantage: a flexible system can be built, accurately reflecting the peculiarities of the knowledge domain and system task. and the disadvantages: Programming skills in these languages are not common. It may be necessary to hire specialist programmers, or retrain the programming staff. Programming the system will always be a larger (and hence longer and more expensive) task than using a shell. Building expert systems Choice (3) has been the most frequent choice for commercial systems in recent years. Building expert systems You will remember that an expert system shell is a ready-made expert system, with the knowledgebase missing, together with instructions for building a knowledgebase in the customer's chosen domain. The idea of an e.s. shell User Interface Inference Engine Knowledgebase on blood infections The idea of an e.s. shell User Interface Inference Engine Knowledgebase on chest infections The idea of an e.s. shell User Interface Inference Engine Knowledgebase on skin diseases Shells Some organisations avoid using shells for building complete expert systems; but even they frequently use them for training building prototypes Expert system programming environments Some people make a distinction between e.s.shells and e.s.programming environments (or "hybrid systems"). For instance, Efraim Turban does in his book (Turban, 1992). Expert system programming environments Historically, this has been important because, in the 1980s, most expert systems projects in the UK used shells (as described below), and most expert systems projects in the USA used environments. Expert system programming environments Environments were so called because they provided several different forms of knowledge representation, for instance, rules metarules frames semantic nets and several different forms of inference, e.g. forward chaining backward chaining bidirectional chaining non-monotonic reasoning Expert system programming environments They needed more powerful hardware than a microcomputer - usually, a workstation. Historically, e.s. shells have been more constrained, perhaps offering only a single kind of knowledge representation. They would usually be designed to run on a PC. Expert system programming environments However, in recent years, E.S.shells have become more sophisticated, and added multiple forms of knowledge representation and of inference strategy. PCs have become more powerful, and PC versions of e.s.environment software have been released. Expert system programming environments It is probably not useful to make the distinction any more. One could simply speak of "simple shells" and "sophisticated shells". Advantages and disadvantages of expert system shells Advantages: The programming effort that has gone into building the user interface and inference engine is re-used. Using a shell: advantages Advantages: The level of programming skill needed to produce the finished system is much lower than it would be if the system was programmed from scratch using a language. This means that, if an appropriate shell is chosen, the project can be completed faster, and cheaper. Using a shell: disadvantages Disadvantages: e.s.tools are "end-user tools". Compared with systems programmed from a language, such software packages tend to produce systems that have poor documentation weak security difficult maintenance problems Using a shell: disadvantages Disadvantages: the problem of flexibility If the shell is a poor match for the type of knowledge in the domain concerned, it is liable to produce a system which simply doesn't correspond to the expertise of the original domain expert; Using a shell: disadvantages In an attempt to model a non-standard piece of reasoning, the system builders may produce a "system" which consists of two or more expert system shells side by side. Such a "system" is bound to be unsatisfactory, and to lead to problems of use, maintenance and training. The problem of flexibility The principle underlying the expert system shell is that a knowledgebase can be removed from an expert system, another can replace it, and the system will reason just as effectively with the new knowledge as with the old. The problem of flexibility This assumes that the same inferencing techniques are used by every expert, and in every domain. The problem of flexibility In fact, there is evidence that Different experts use different problemsolving skills; Different types of problem-solving task require different types of reasoning. The problem of flexibility "...it must be established that the logic and reasoning method incorporated in the shell correspond to those used by the human expert in problem solving, otherwise the project is almost certainly doomed to failure." Ian Graham, in Forsyth (1989), p.81 Factors involved in choosing a shell, or other software tool, for an e.s. project 1. The characteristics of the knowledge, and the style of inference, used by the domain expert or experts. 2. The time and money available for the project. 3. The programming capabilities available in-house (what languages do the programmers know? Is it feasible to retrain them?). Factors involved in choosing a shell, or other software tool, for an e.s. project 4. The hardware available for development. 5. The hardware the system will eventually run on. 6. The required performance of the system. Factors involved in choosing a shell, or other software tool, for an e.s. project The selection procedure should involve: a) Doing enough knowledge acquisition to establish (1). b) Deciding whether shells are available whose inference strategies and knowledge representation match the requirements of the problem. If not, is the skill available to treat this as a job for programming in a computer language? Factors involved in choosing a shell, or other software tool, for an e.s. project c) Establishing that software suggested by stage (b) will run on the available hardware, and provide adequate performance in terms of speed, etc. d) Establishing that sufficient time and money is available for the project. Factors involved in choosing a shell, or other software tool, for an e.s. project e) Establishing that any shell still under consideration has the capabilities required by the project. Has it got adequate explanation facilities? Can it handle a large enough knowledgebase? Can it interface easily with other pieces of software which are to be used by the finished system? Factors involved in choosing a shell, or other software tool, for an e.s. project These questions should decide whether the project is viable at all and, if it is, which shell, or AI language, or conventional language, is the appropriate tool for the job. Example of an up-to-date PC shell: Acquire SDK Acquire SDK is marketed by a Canadian software house (Acquired Intelligence Inc) as one of a range of expert system tools. The knowledge-representation involves objects (as used in object-orientated programming; these are conceptually very similar to frames) combined with rule-based reasoning. Example of an up-to-date PC shell: Acquire SDK Product description, and testimonials, taken from their web site (Nov.2001): Example of an up-to-date PC shell: Acquire SDK “The Acquire Software Development Kit (SDK) lets you integrate the Acquire inference engine and knowledge bases into your applications. You can build intelligent applications using many popular development environments -- including Visual Basic, Visual C++, Java, Delphi, PowerBuilder, ToolBook -- or any other development environment that supports ActiveX controls or DLL function calls.” Example of an up-to-date PC shell: Acquire SDK “Acquire SDK 2.1 lets you operate multiple knowledge bases simultaneously within a single application, and lets many users access the same knowledge base at the same time. Under special arrangements, the Acquire SDK libraries are available for SCO Unix, Sun OS, Solaris, and Linux, and can be ported to almost any Unix variant.” Example of an up-to-date PC shell: Acquire SDK “ Easy to use -- you can build a fullfeatured intelligent application in Visual Basic with just a handful of statements. The inference engine generates events when a rule fires, when a conflict occurs, or when it needs additional information. Ability to utilize multiple knowledge bases simultaneously in one application. Ability to deliver client/server applications.” Example of an up-to-date PC shell: Acquire SDK “ Includes sample applications that show you how to build WWW applications with CGI or Java. Ability to access the contents of knowledge bases, including messages written by the knowledge base author that can be used to give situationspecific commands to your application, and permitting customization from within the knowledge base.” Example of an up-to-date PC shell: Acquire SDK “ Flexibility of data source: obtain input interactively from the user, from the knowledge base, from a database or spreadsheet, or from a hardware device or other source. The expert system is embedded - the user needn't be aware that an expert system is being used at all.” Example of an up-to-date PC shell: Acquire SDK “When we first discussed the possibility of an expert system in neuropsychology, I thought it was an interesting, albeit impossible idea. Now that I have used ACQUIRE® to build two different knowledge bases (in neuropsychology and school psychology) I am looking forward to building other applications for my clinical practice.” Dr. Diane Russell, Neuropsychologist Example of an up-to-date PC shell: Acquire SDK “Radio interference is a complex, diagnostic problem that all countries have. Using ACQUIRE® has allowed us to build a huge, comprehensive and complex knowledge base (The Radio Interference Advisor) that is so well structured that it is very easy to understand, use and maintain. It usually takes up to three years to teach a new technician to be a radio inspector. Example of an up-to-date PC shell: Acquire SDK Once trained as a radio inspector, solving particularly difficult radio interference problems (e.g., intermodulation products) can still be very labour intensive. We are using this as a tool to speed up both the training process and the diagnostic process. It is an extraordinary learning tool, so it can also be used in the classroom. Example of an up-to-date PC shell: Acquire SDK We've been finding new applications for the software even before it's finished.” Dave Sinclair Operations Manager, Spectrum Industry Canada (Retired) Example of an up-to-date PC shell: Acquire SDK “MacMillan Bloedel is using the powers of ACQUIRE® to assist personnel in machine startup and to help diagnose machine breakdown. One of the greatest strengths of this product is that it is designed for the expert to build his/her own knowledge base. Example of an up-to-date PC shell: Acquire SDK Bypassing the requirement of a knowledge engineer can significantly reduce the project costs and lower the risk of misinterpreted information. In addition, ACQUIRE® operates on a PC platform, eliminating the need to purchase specialized computer equipment.” Sharlene Yap Computer Scientist, Wood Harvesting Example of an up-to-date PC shell: Acquire SDK “The ACQUIRE® knowledge acquisition system is the underlying technology for an intelligent tutoring system for crew training. The resultant system, ACQUIRE®ITS, inherits the benefits of ACQUIRE® while providing the tools with which the general PC user can develop and maintain their own intelligent tutoring applications.” Canadian Space Agency Example of an up-to-date PC shell: Acquire SDK “Analysing international trade in commodities and forecasting market prices are particularly difficult tasks. Each market differs considerably, and the trader or analyst must develop detailed knowledge of his/her specialist area. Mathematical modeling is often unsuccessful because it fails to represent this knowledge adequately, especially that relating to the Example of an up-to-date PC shell: Acquire SDK nonquantitative factors which affect commodity markets. ACQUIRE® allowed us to rapidly model an important and complex commodity market (for Soybeans), paying attention to the psychological elements of "market sentiment". The resulting system, SoyTrader, incorporates a number of rules which make it a considerable advance on other formal models of this Example of an up-to-date PC shell: Acquire SDK market. ACQUIRE® allowed us to prototype SoyTrader quickly, and to achieve impressive forecasting results; results which other analysts had doubted were possible.” Geoffrey Bastin Economist, MIL, London, U.K. Examples One piece of knowledge represented in three rule-based shells. Original knowledge, elicited from the domain expert (a salesman for life assurance products): "Suppose the customer has a lump sum to invest, and they want to see some growth in the investment. Suppose also that they do want a pension, but don't need life cover. In that case, I'd advise them to buy an annuity.” Example: Crystal This knowledge represented in Crystal: Annuity IF lump sum to invest AND growth desirable AND pension needed AND NOT life cover needed AND: conclusion display Example: Leonardo This knowledge represented in Leonardo: 1:if investment is 'lump sum' 2:and growth is desirable 3:and pension is desirable 4:and life.cover is unnecessary 5:then advice is annuity Example: Leonardo Object number: 2g 1:Name: investment 2:Type: 3:Certainty: 4:Default value: 5:Allowed value: regular, lump sum 6:Compute value: 7:Query prompt: What kind of payment are you prepared to make? Example: Leonardo 8:Query preface: We have to establish first whether you wish to save regularly or merely invest a single lump sum. Later we may explore a combined approach. - NB there are 18 slots in an object frame. Example: Guru This knowledge represented in Guru: RULE: R1 IF: INVESTMENT = "lump sum" AND GROWTH = "desirable" AND PENSION = "desirable" AND LIFECOVER = "unnecessary" NEEDS: INVESTMENT, LIFECOVER, GROWTH, PENSION THEN: ADVICE = "annuity" Example: Guru REASON: For someone who wants capital growth and a pension but has no need of life cover, the best use of a lump sum is the purchase of a deferred annuity.