The Development of a Bilingual Fuzzy Expert System Shell J. King Saud University, Vol. 21, Comp. & Info. Sci, pp. 27-43, Riyadh (2009/1430H.) The Development of a Bilingual Fuzzy Expert System Shell Hassan Mathkour, Israa Al-Turaiki and Ameur Touir Department of Computer Science King Saud University Riyadh, Saudi Arabia mathkour@ccis.ksu.edu.sa, binmathkour@yahoo.com, touir@ksu.edu.sa (Received 21/12/2008; accepted for publication 02/03/2009) Abstract. Fuzzy logic has been incorporated in many expert systems to solve real world problems that are inherently ambiguous. With fuzzy logic it is possible to program human intuition through the development of fuzzy expert system shells. A fuzzy expert system shell is a tool that helps build expert systems to manage fuzzy problems. Commercial as well as non-commercial fuzzy expert system shells are available. These shells provide variety of functions to facilitate the development of fuzzy expert systems for real world problems in different application areas such as medicine, engineering, and finance. To the best of our knowledge, none of the available fuzzy shells is natively developed for the Arabic language. This paper describes the development and the experimentation of a bilingual fuzzy expert system shell. This shell is intended to be a research tool for fuzzy expert systems developers in bilingual environments similar to those in the Arab world where users and developers use multi-languages due to their educational backgrounds and working environments. The shell processes fuzzy terms of the Arabic language as well as the English language. The shell is a general purpose shell that provides users with the ability to develop Arabic/English fuzzy expert systems using a simple Graphical User Interface. It applies implication methods that bear resemblance to human intuition. In the process of the development, a comparison of various fuzzy expert system shells has been performed to identify strengths and weaknesses of available shells. Experiments with our shell are reported and its performance is compared to existing shells that use different implication methods. Keywords: Expert system shells, knowledge based systems, Fuzzy Implication methods, Bilingual Systems. 1. Introduction Expert system shells are versatile tools that are used to create expert systems. Fuzzy expert system shells have been developed to allow for reasoning that deals with crisp and fuzzy sets. These shells allow incorporation and manipulation of imprecise information using fuzzy set theory developed by Zadeh (Zadeh, 1965). They are used to create expert systems that can handle imprecise situations effectively. The ability to operate under imprecise environment makes expert systems closely behave like human being and provides a natural representation of people's daily terminologies. The ability of treating ambiguities, in a manner similar to human experts, makes expert systems versatile and adaptable to unforeseen circumstances which are difficult to avoid in real life applications. This has made fuzzy logic a suitable means to deal with the fuzziness of data and knowledge frequently encountered in the terminologies of human experts when developing knowledge based systems (Kelmet and Slany, 1993). There have been attempts to design fuzzy expert system shells for large-scale general-purpose as well as domain specific applications (Philip, 1991; Aly and Vrana, 2006). Over the years, a large number of expert system shells have been developed and several of them are commercially available. JFK (López-Ortega, 2006), FuzzyShell (Pan, 1996), FuzzyJess (Orchard, 2001), FuzzyCLIPS (Orchard, 2004), FLINT (Shalfield, 2005), FLOPS (Siler and Buckley, 2005), Fuzzy Logic (Mathworks, 1999), and FuzzyJ toolkit (Council, 2001; Orchard, 2001) are examples of expert system shells. We have analyzed several of the existing shells in an attempt to indentify a shell having features that natively supports application development in Arabic language while allowing for application development in other languages. We searched for a shell that accommodates for Arabic fuzzy terms naturally and which employ intuitional inference methods. Our unsuccessful endeavor and realizing that making such a shell available will be useful for bilingual developers and users in research and educational environments motivated us to design and implement a fuzzy shell with Arabic/English support. 27 28 Mathkour et al.: The Development of a Bilingual Fuzzy Expert System Shell In the process, we have found it helpful to furnish a comparison for a set of the available fuzzy shells. These shells differ from one another in several aspects. For example, most of the shells implement inference methods that are mentioned in (Zadeh, 1975; Mamdani, 1977) while many (Fukami, 1980; Mizumoto, 1981; Mizumoto, 1982) have advocated that the methods that are based on the interpretation given in (Mizumoto et al., 1979; Mizumoto et al., 1979; Mizumoto et al., 1979) perform better as they induce human intuition. In this research, we have taken the interpretation that is supported in (Mizumoto et al., 1979; Mizumoto et al., 1979; Mizumoto et al., 1979; Mizumoto, 1981). Our work in (Mathkour et al., 2009) introduces an Arabized fuzzy expert system shell. In this paper, we present the development of a bilingual (Arabic/English) fuzzy expert system shell, which is an extension of our work in (Mathkour et al., 2009), to allow for both the Arabic and English languages. We also report on experiments with the shell using real life data to demonstrate and analyze its human-like behavior using the selected inference methods. To measure its effectiveness, we have compared its performance with some of the available shells. We report on the experiments and comparison of our shell with FuzzyClips (Orchard, 1996) and FuzzyJ (Council, 2001; Orchard, 2001). The objective of our extended shell is to provide a comprehensive tool that is intended to be a research tool for fuzzy expert systems developers in multi-lingual environments similar to those in the Arab world where users and developers use multi- languages due to their educational backgrounds and working environments. It is a general purpose shell that is based on the implication methods: Rs, Rg, Rgs, Rgg, Rsg and Rss (Fukami, 1980; Siler and Buckley, 2005; Mizumoto et al., 1979; Mizumoto et al., 1979; Mizumoto, 1981). It is also observed that many shells use dedicated programming languages for the expert system application development. Consequently, application developers are required to learn the programming languages that are supported by these shells. Learning a new programming language is not a desired requisite, especially for those who do not have a programming aptitude. Learning a new programming language distracts developers from their main objective of developing expert systems in their specific domains. In our shell, we have used a visual environment by adopting a simple graphical user interface. The interface supports both Arabic as well as English languages and it can be tailored for other languages by adding the user interface support for the required language. In (Mathkour et al., 2009), we developed comparison criteria to evaluate aspects of available expert system shells. The criteria include evaluation of end-user interface, developer Interface and availability and installation of shell. In this paper, we further discuss these criteria and employ them to formulate comparison tables of a larger number of existing expert system shells. The rest of the paper is organized as follows: Section 2 presents a comparison of twenty expert system shells along with brief description of the comparison criteria. Section 3 presents the developed fuzzy shell, describes the implication methods, and the implementation. Section 4 presents experimentation with the system. Section 5 presents a comparison of our shell to some existing ones. Section 6 concludes the paper. 2. Comparison of Existing Shells We have endeavored to compare the features of twenty shells of those available commercially and otherwise. These include Fuzzy Logic(Mathworks, 1999), JFK (López-Ortega, 2006), FuzzyJess (Orchard, 2001), FuzzyCLIPS (Orchard, 2004), FuzzyShell (Pan, 1996), FLINT (Shalfield, 2005), FLOPS (Siler and Buckley, 2005), CLIPS (Giarratano, 1998), Jess (Friedmann-Hill, 1999), Flex(Vasey, 1996), PSS (Forgy, 1981), ESB (Kent and Denholm, 1990), ESBuilder (Ishihara et al, 1995), and FuzzyJ toolkit (Council, 2001; Orchard, 2001). First we present a discussion of the comparison criteria, then present the results of our comparison in Table 8. 2.1 End-user interface The user interface is an important component of any software development tool as it allows interaction between application developers and the tool. The user interface must be natural in the context applications that are being developed thereby releasing the developers from learning extraneous concepts and focusing on the development issues. J. King Saud University, Vol. 21, Comp. & Info. Sci, Riyadh (2009/1430H.) 29 The quality of the user interface is judged by its ease of use and naturalness. The following features are indicators of the quality of an interface: 1. Explanation facilities: This is used to explain the process through which the system has arrived at a decision. 2. User friendliness: This is judged by the quality of graphical user interface components such as menus, buttons, and usage of a natural language. 3. The ability to change the earlier answers without having to repeat the session from the beginning. 2.2 Developer interface The expert system developers enter their knowledge through the rule editor. The rule editor should support the rule type selection and creation, rule change and update process, mathematical operations to implement the inference engine strategies, built-in member functions, de- fuzzification methods, certainty factor handling, error correction, and fact refinement and documentation. In addition to these, the rule editor must have provisions to interact with external environments like DBMSs, Spread sheets and Programming in modern languages like Java and C#. Features related to the rule editor are shown in Table 1 to Table 5 with their respective weights. 2.3 Procurement and installation The availability of these tools could be problematic in some linguistic regions of the world. Once available, their installation is not always straight forward. Hence we have used it as an evaluation factor. Table 6 and 7 shows the weight assigned to measure the ease of procurement and installation. Table 1. Rule type weight Rule Type Weight Complex IF-THEN-ELSE rule 5 Complex IF-THEN rule (multiple antecedents or/ and multiple consequents) 3 Simple IF-THEN rule (one antecedent one consequent) 1 Table 2. Rule chaining weight Method Symbol Forward F Backward B No built in chaining strategy (user defined) NA Table 3. Math capability weight Supported Math Functions Weight Advanced math functions 5 Basic math functions 3 None 1 Table 4. Inference strategy weight Supported Inference Strategies Weight None 1 One or Two 3 Three 5 Table 5. Documentation weight Documentation Weight Comprehensive & easy to read 5 Brief 1 Table 6. Procurement weight Procurement Method Weight Download from the Internet 5 Order package CD 1 Table 7. Installation weight Installation Method Weight Unpack (run) one file 5 Unpack source and compile 1 3. The Proposed Bilingual Fuzzy Expert System Shell The entry point to the system provides the users with the option of building expert systems using Arabic or English knowledge bases (Fig. 1). Upon selection, Arabic or an English screen portraying the main components of system is displayed (Fig. 2.a and 2.b). The main components of the shell are the variable editor, rule editor, and the inference engine. 3.1 The variable editor The variable editor’s main purpose is to provide functions to create, edit, and delete fuzzy variables, their fuzzy values, membership functions, and universe of discourse. The layout of our variable editor is shown in Fig. 3.a and 3.b. The variable editor can be launched from the menu button of “Variable Editor” “محرر المتغيرات” in Fig. 3. Created variables and their properties can be seen from a dropdown menu. 30 Mathkour et al.: The Development of a Bilingual Fuzzy Expert System Shell ; a - - • - 1-' - - - - - - - 1- - - - "a - - . -1- • - - - - - - - 1- - - - ~ - - - - - - - - - - - - - 1- - - - ~ - - - - - - - - - - - - - 1- - - - :- ........ - - 1- ;; .... - ~ _.... - - I........ - ..... ~- - - - - 1- - - - - - - - - 1- - - - .~ - - - - -1- ' - - - - - - - 1- - - - .! ......... - - I ..... ;; - - - -.... .... ..... I....... .... ..... J - - - - 1- ;; - - - - - - - 1- - - - ~... ..... - - - I ..... ~ ...... - - - .... - I......... .... .... •• - - - - - - - - - - - - - 1- - - - J! --:Ii - - ..... - I..... ... ... ... ... ... - ..... - I.... - .... .... 0- - - - - 1- - - - - - - - - 1- - - - ~ - - - - 1- - - - - - - - 1- - - - ~" - - - - 1- - - - - - - - - 1- - - - ~.ti - - - -1- - - - - - - - - 1- - - - ~ - - - - 1- · - - - - - - - 1- - - - ~ - - - - 1-0 1- - - - - - - 1- - - - LR - - - - !:..:L - - - - - - = != : : : ~ - - - ..... I-:.if-....... ..... .......... ..... 1-' ~. ~ tt· ~ !!j~hJ!,,-=i Hi ---'=-----1 "'''''' ....... " _ _ ' (assert (cons high) ) ) Fig. 18. Fuzzy rule definition using fuzzyCLIPS. 38 Mathkour et al.: The Development of a Bilingual Fuzzy Expert System Shell FuzzyCLIPS was run several times with the same observations in Section 4 and the results are as follows (Figures 19 to 22): Observation 1 : X is Low , Y is High and Z is high. FuzzyCLIPS gives the expected result according to Criteria I in Table 9. This is natural and expected as all observations match all antecedents. Fig. 19. FuzzyCLIPS result for Observation 1. Observation 2: X is not low, Y is not high and Z is not high. When the antecedents contain the NOT hedge, FuzzyCLIPS yields a fuzzy set that cannot be mapped to a linguistic expression. This is expected as Mamdani's methods do not satisfy Criterion IV-1 and Criterion IV-2 of Table 9. Fig. 20. FuzzyCLIPS result for observation 2. Observation 3: X is very low, Y is very high and Z is very high. FuzzyCLIPS gives the expected result according to Criteria II-2 in Table 9. Fig. 21. FuzzyCLIPS result for observation 3. Observation 4: X is more or less low, Y is more or less high and Z is more or less high. The resulting fuzzy set cannot be mapped to a linguistic expression. From the result shown in figure 9 it is clear that Mamdani's methods do not satisfy criterion III. Fig. 22. FuzzyCLIPS result for observation 4. 5.2 Comparison with FuzzyJ Toolkit FuzzyJ Toolkit is a set of Java classes that provide the capability to handle fuzzy concepts and reasoning (Orchard,2001). It allows for different inference methods including those in (Aly and Vrana, 2006; Mamdani, 1977). We examine the behavior of FuzzyJ Toolkit using the rules and fuzzy variables of Section 4. Figures 23 to 27 show the fuzzy variables and fuzzy rule definitions. J. King Saud University, Vol. 21, Comp. & Info. Sci, Riyadh (2009/1430H.) 39 Fig. 23. Definition of fuzzy variable x using fuzzyJ toolkit. Fig. 24. Definition of fuzzy variable y using fuzzyJ foolkit. Fig. 25. Definition of fuzzy variable z using fuzzyJ toolkit. 40 Mathkour et al.: The Development of a Bilingual Fuzzy Expert System Shell FuzzyJ was run several times with the same observations in Section 4 and with the inference method set to Larsen's inference method. The results of the inference are as follows: Observation 1 : X is Low, Y is High and Z is High. The resulting fuzzy set is {0/70, 0.2/75, 0.5/80, 1/85, 0.5/90, 0.2/95, 0/100}. Here the result given by FuzzyJ is "high" which is natural as all the observations match the all the antecedents of the fuzzy rule. Observation 2: X is not low, Y is not high and Z is not high. The resulting fuzzy set is {0/70 ,0.1/75, 0.25/80 ,0.5/85, 0.25/90 ,0.1/95, 0/100}. This result could not be mapped to a linguistic expression although it is rather close to the fuzzy set "high". Observation 3 & Observation 4: The resulting fuzzy set is {0/70, 0.2/75, 0.5/80, 1/85, 0.5/90 ,0.2/95, 0/100}. Here the result given by FuzzyJ is "high". Notice that this is the same result when no hedges were used. It is obvious that the use of the hedge "very" and the "more or less" hedge had no effect on the result. In our shell the Fig. 26. Definition of fuzzy variable conclusion using fuzzyJ toolkit. Fig. 27. Definition of the fuzzy rule using fuzzyJ. J. King Saud University, Vol. 21, Comp. & Info. Sci, Riyadh (2009/1430H.) 41 hedges were recognized through the calculation of the implication criteria of Table 9. 6. Conclusion In this paper, we discussed the development of our own bilingual fuzzy expert system shell. In the process, we have examined, evaluated, and compared various fuzzy expert system shells that adopt different inference methods for the sake of identifying desirable features and examining their performance. Our shell was developed using NetBeans 4.1 IDE. It has an Arabic user interface as well as an English user interface. The inference engine is a backward chaining inference engine. It uses the implication methods Rs, Rg, Rss, Rgg, Rgs and Rsg. Several tests have been performed on this shell to ascertain its proper functionality. Some of the tests have given the expected results that reflect human intuitions. Few tests have given results which are very close to the expected outcome. We observe that when the membership function of fuzzy values covers a wide range from 0 to 1, the shell produces more accurate results. Experimental results for our shell have been reported and analyzed. A comparison of the performance of our shell with other shells such as FuzzyCLIPS and FuzzyJ has also been discussed. We are in the process of extending the shell to allow for the processing of fuzzy terms in other natural languages. References Aly, S. and Vrana, I.. " Toward efficient modeling of fuzzy expert systems: a survey" Agric. Econom. - Czech, (2006), 456-460. Bandler, W. and Kohout, L. “Fuzzy power sets and fuzzy implication operators”, Fuzzy Sets and Systems, 4, (1980), 13-30. Council, C. and Orchard, R. “Fuzzy reasoning in jess: The fuzzyj toolkit and fuzzyjess”, The Proceedings of 3rd International Conference on Enterprise Information Systems (ICEIS 2001), Setubal, Portugal, (2001). Forgy, C.L. “The OPSS User Manual”, Technical Report, CMU- CS-81-135, Computer Science Department, Carnegie-Mellon University, Pittsburgh, (1981). Friedmann-Hill, E.J.. “Jess, The Java Expert System Shell”, http://herzberg.ca.sandia.gov/jess/, (1999). Fukami, S.; Mizumoto, M. and Tanaka, K. “Some Considerations on Fuzzy Conditional Inference”, Fuzzy Sets and Systems, 4, (1980), pp.243-273. Ganoud, A.; Ali, H. and Ibrahem, S. "Studying the Influence of random Factors on the Planning of Building Work", Tishreen University Journal for Studies and Scientific research- Engineering Science series, 27(3), (2005). Giarratano, J.C. “The CLIPS User’s Guide”, http://www.twine.com/twine/11lslvj57-19d/clips-expert- system-shell, (1998). Kent, J.R. and Denholm, P. “ESB-96 – A Graphical KBS Development Tool”, in Europal'90, Proceedings of the First European Conference on the Practical Application of Lisp. Dorking, March (1990). Ishihara, S.; Ishihara K.; Nagamachi, M. and Matsubara, Y. “An Automatic Builder for a Kansei Engineering Expert System using self- Organizing Neural Networks”, Int. Journal of Industrial Ergomonics, 15(1), (1995), 13-24. Kelmet, E. and Slany, W. “Fuzzy Logic in Artificial Intelligence”, Proceedings of the 8th Austrian Artificial Intelligence Conference, FLAI '93, Linz, Austria, (1993). Leung, K. S.; and Lam, W. "Fuzzy Concepts in Expert Systems",IEEE Computer, 21(9), (1988), 43-56. López-Ortega, O. " Java Fuzzy Kit (JFK): A shell to build fuzzy inference systems according to the generalized principle of extension", Expert Systems with Applications, (2006). Mamdani, E.H. “Application of fuzzy logic to approximate reasoning using linguistic systems”, IEEE Trans. Comput. 26, (1977), 1182-1191. Mathkour, H.; Al-Turaiki, I. and Touir, A. “The Development of an Arabized Fuzzy Expert System Shell” in int. conf on Information Management and Engineering ICIME, (2009). Mathworks, Inc. Fuzzy Logic Toolbox Use's Guide version 2, (1999). Mizumoto, M.; Fukami, S. and Tanaka, K. “Fuzzy conditional inference and fuzzy inference with fuzzy quantifiers”. in: Proc. of 6th Int. Conf. on Artificial Intelligence, Tokyo, (1979), 589-591. Mizumoto, M.; Fukami, S. and Tanaka, K. “Some methods of fuzzy reasoning”, in: M.M. Gupta et al., ads., Advances in Fuzzy Set Theory and application (North-Holland, Amsterdam, (1979), 117-136. Mizumoto, M. Note on the arithmetic rule by Zadeh for fuzzy conditional inference, Cybernetics and Systems, 12, (1981), 247-306. Mizumoto, M. “Fuzzy inferences under max- composition in the compositional rule of inference”, in: M.M. Gupta et al., ads., Fuzzy Information and Decision Processes, North-Holland, Information Sciences, 27, (1982), 183-209. Mizumoto, M.; Fukami S. and Tanaka, K. “Several methods for fuzzy conditional inference”, in: Proc. of IEEE Conf. on Decision & Control, Florida, (1979), 777-782. Orchard, R. “NRC FuzzyJ Toolkit for the Java™, Platform User’s Guide” [online]. National Research Council of Canada. Available from:http://ai.iit.nrc.ca/IR_public/fuzzy/fuzzyJDocs/index.ht ml, 2001. Orchard, R. "Fuzzy Reasoning in Jess: The FuzzyJ Toolkit and FuzzyJess", Proceedings of the ICEIS 2001, Third International Conference on Enterprise Information Systems, Setubal, Portugal. (2001), 533-542. Orchard, R. FuzzyClips version 6.10d User's Guide,National Research Council of Canada, (2004). Pan, J. FuzzyShell User's Manual,(1996). Philip, G., "A case study in selecting an expert system shell", Journal of Systems Management, (1991). Shalfield, R. FLINT Reference, Logic Programming Associates Ltd.,(2005). Siler, W. and Buckley, J. Fuzzy Expert Systems and Fuzzy Reasoning, John Wiley & Sons, Inc., New Jersey, (2005). Vasey P.; Westwood D. and Johns N. “Flex Expert System Toolkit”, Logic Programmers Associates Ltd. (1996). 42 Mathkour et al.: The Development of a Bilingual Fuzzy Expert System Shell Willmott, R., “Two fuzzier implication operators” in the theory of fuzzy power sets, Fuzzy Sets and Systems, 4, (1980), 31-37. Zadeh, L.A. Calculus of fuzzy restriction, in: L.A. Zadeh et al., Eds. Fuzzy Sets and Their Applications to Cognitive and Decision Processes (Academic Press, New York, (1975) 1-39. Zadeh, L.A. "From Computing with Numbers to Computing with Words− From Manipulation of Measurements to Manipulation of Perceptions", iee transactions on circuits and systems, Fundamental theory and applications, 45(1), JANUARY (1999), 105-119. Zadeh L.A. “Fuzzy sets” information and control 8, (1965), 338- 353. Zadeh, L. A. "Why the Success of Fuzzy Logic is not Paradoxial", IEEE Expert, 9, (1994), 43-45. J. King Saud University, Vol. 21, Comp. & Info. Sci, Riyadh (2009/1430H.) 43 تطوير صدفية ثنائية اللغة لبناء النظم الخبيرة الضبابية عامر عبداهللا طويرو حسن إسماعيل مذكور، إسراء محمد الطريقي قسم علوم احلاسب، كلية علوم احلاسب و املعلومات، العربية السعوديةجامعة امللك سعود، الرياض،اململكة mathkour@ksu.edu.sa )م٢/٣/٢٠٠٩؛ وقبل للنشر يف م٢١/١٢/٢٠٠٨(قدم للنشر يف يستخدم املنطق الضبايب يف بعض النظم اخلبرية حلل مشكالت من احلياة العملية واليت تتسم بالغموض. إذ . ملخص البحث استخدام املنطق الضبايب لربجمة التطبيقات اليت تعتمد على احلدس البشري من خالل بناء صدفيات لتطوير النظم من املمكن اخلبرية الضبابية من أحل التعامل مع املشكالت الضبابية و الغري واضحة. و توفر هذه الصدفيات تشكيلة من الدوال ميكن االت و التطبيقات مثل التطبيقات الطبية، استخدامها لتسهيل تطوير نظم خبرية ضبابية للتعا مل مع مشكالت يف خمتلف ا واهلندسية، واملالية. ال تتوفر حسب علمنا صدفيات برجمة ضبابية، لبناء النظم اخلبرية الضبابية، مطورة يف األصل للتعامل مع لضبابية ثنائية اللغة. اهلدف من هذه الصدفية اللغة العربية. تصف ورقة العمل هذه تطوير وجتربة صدفية لبناء النظم اخلبرية ا الربجمية هو استخدامها كأداة حبثية ملطوري النظم اخلبرية الضبابية يف البيئات ثنائية اللغة كما هو احلال يف العامل العريب حيث مع املصطلحات تكون استخدامات املطورين متعددة اللغات بسبب نظام تعليمهم وبيئة عملهم. تسمح الصدفية بالتعامل الضبابية يف اللغتني العربية واإلجنليزية. وتعترب صدفية برجمة عامة األهداف توفر للمستخدمني القدرة على تطوير نظم خبرية ضبابية عربية وإجنليزية باستخدام واجهة مستخدم مبسطة. وتقوم بتطبيق طرق االقتضاء يف حماكاة للحدس البشري. مت عند ارنة عدة صدفيات لتطويرو برجمة النظم اخلبرية الضبابية لتحديد نقاط القوة والضعف للربجميات املتوفرة. التطوير دراسة و مق كما مت إعداد تقرير عن جتربة و اختبار الصدفية املطورة ومقارنة أدائها مع الصدفيات املتوفرة واليت تستخدم طرقًا اقتضائية خمتلفة. 44 Mathkour et al.: The Development of a Bilingual Fuzzy Expert System Shell