CSCI222 Lab1:- Expert System

Task : Classification

Domain : 33 Agarics Mushrooms

Tool : CLIPS (V6.10 07/01/98) on both SUN and PC

Title : Is-one-of 33 Agarics Expert System

Source file : Agarics.clp   How to run this file:- (load Agarics.clp)  then (reset) then (run)

Output file : Agarics1.out, Agarics2.out

Batch file : Agarics.bat

Introduction    BackgroundReference   What others have done in this and related areas
What I actually did    A description of the solution/algorithms   A sample run
A sample run of possible error situations   The system limitations   Future Works
The information of 33 Agarics


NOTE : This system is just a tool to help you classify Agarics. Since deadly poisons are found in many species of the genera Amanita and Gelerina which are grouped under the Agarics, it is your responsibility not to experiment with mushrooms that you cannot positively identify.

The information that I used in this program I got from these books:

[1] Bigelow, Howard E., MUSHROOM pocket field guide, New York: Macmillanpublishing co., inc., 1974

[2] Hesler, L. R., MUSHROOMS of the great smokies, Tennessee: The university of Tennessee Press, 1960

[3] Orr, Robert T., and Orr, Dorothy B., Mushrooms of Western North America, California : University of California Press, Ltd., 1979

[4] Knopf, Alfred A., Familiar Mushrooms, New York: Chanticleer Press,Ltd., 1990

[5] Bessette, Alan., and Sundberg, Walter J., Mushrooms, New York: MacmillanPublishing Company, 1987

[6] McKenny, Margaret., The Savory Wild Mushroom, Seattle: Universityof Washigton Press, 1962

[7] Arora, David., Mushrooms Demystified, California: Ten Speed Press,1979

[8] Atkinson, George Francis., Mushrooms, second edition, New York: Hafner Pub. Co., 1961

[9] Smith, Alexander H. Smith Helen V. and Weber Nancy S., How to know that Gilled Mushrooms, Iowa: The Pictured Key Nature Series, 1979


Introduction

      Since I like to eat mushrooms and saw a lot of mushrooms growing in my backyard, I wanted to learn how to classify them. Combining my interest in computer with my love of mushroom I worked on a classification application when I studied my bachelor degree in Thailand. I used C Language to build a Mushroom Classification Expert System but it did not impress me much because it contained bunches of IF-THEN statements. After I have worked a little bit on CLIPS now that I am in the States, I think I can re-write my expert system and by using CLIPS I can make it better than the previous one. Only at this time, I narrow my mushrooms data down to the group of gills mushrooms, known as Agarics, in the America north west.

 

Background

       There are a lot of fleshy fungi in the United States and adjacent Canada. Bigelow [1] grouped the fungi into11 groups including Agarics, Bolets, Hydnums, Clavarias, Polypores, JellyFungi and Relatives, Puffballs, Bird’s Nest Fungi, Stinkhorn, Earth Star,and Morels and Cup Fungi. They are mostly found from April to November and during the winter months if there is enough moisture. The Gilled mushrooms are the largest group, of interest to the mushroom hunters. The gilled mushroom includes both the most dangerous poisonous species and the best edible ones. The gill fungi are called Agarics. Figure 1 illustrates the parts of a mushroom of the Agarics. Figure 2 shows where the Agarics belong in the mushroom classification tree.

Figure 1 Parts of a mushroom [2]

Figure 2 The scope of this system



 

What others have done in this and related areas

http://www.cnbc.cmu.edu/~medler/papers/mushroom.html:- Canadian Artificial Intelligence, Winter 1996, 38, 14-17
This page contains the information in Biological Computation project at the Department of Psychology in University of Alberta. The project names "Of Mushrooms and Machine Learning: Identifying Algorithms in a PDP Network" by Michael R. W. Dawson & David A. Medler. "The purpose of the current experiment was to determine if an artificial neural network could learn to identify correctly a mushroom as edible or not. In particular, we were interested in seeing whether--after the network converged--we could determine the rules that it used to classify mushrooms."

http://www.cs.waikato.ac.nz/~ml/publications.html:- Objective measurement of mushroom quality by           Kusabs N., Bollen F., Trigg L., Holmes G. and Inglis S. (1998) Proc New Zealand at the Institute of Agricultural Science and the New Zealand Society for Horticultural Science Annual Convention,Hawke's Bay, New Zealand, pp 51. "This paper describes a methodology for establishing an objective measurement of mushroom quality, based on a set of measured physical attributes. These attributes were used by a machine learning tool to model quality based on the classification of professional graders (experts)."

http://www.mykoweb.com/BAF/agaric.html
This webpage contains information of the Bay Area Agarics (Gilled Mushrooms) and it is written by Michael Wood & Fred Stevens. This page contains all information about each Agarics and includes nice pictures.

 

What I actually did

       This expert system is called IS-ONE-OF 33 AGARICS and gives you some information about 33 popular Agarics, frequenly found in California, Oregon, and Washington. This system helps users classify mushrooms. There are 33 gills mushrooms or Agarics in this system. If the system finds out that a particular mushroom is not one of the 33 Agarics, it will give the answer "It is not one of the 33 Agarics" and it will give the information about mushroom families to which that particular mushroom might belong.

       What the system actully does is asking questions about the mushroom that users want to find out about and if there is enough information for the system to identify that particular mushroom the system will give an answer right a way.  This will save time for users and keep the system from asking useless questions. There are 2 kinds of questions that are used in this system. The first one is aYES/NO question, which will have "Y/N" sign followed by the "?" and users answer by typing in "y" for YES or "n" for NO. The multiple-choice question has the choices a, b, c... for users to select. These two techniques can avoid problems caused by typing errors.

 

A description of the solution/algorithm

       This program consists of two main solutions: the task control solution and the mushrooms classification solution. The task control solution needs to be concern because CLIPS is not the task dependent tool I need to work on coding to make it fixed with my classification task.

        Since the control strategy of this system is rule-based, I added some more rules in order to improve performances of my expert system. By using these eleven (11) control rules, I can prune the space and get to the answer guickly.
 
INTRO 
is the first rule that will be fired and it gives the introduction to the  system, 
Quit 
will be fired after the system gives the answer.
REPEAT 
is the reset and start-again rule which will be fired when users want to continue using the system,  , 
RealQuit 
is the terminate rule
HAVE_GILLS 
contains the most important data this system needs. which is whether or not the particular mushroom has GILLS, It will cause either NO_GILLS or SPORE_COLOR to be fired. This helps prune the mushrooms classification tree when the particular mushroom is not a gills mushroom. The system can tell right the way that it is not an Agarics.
SPORES_COLOR 
contains the first answer of a user answer list, the spore color, and it will cause GILLS_TYPE to be fired. 
GILLS_TYPES 
contains the second answer of a user answer list, the gills types, and it will  causes either BolCorPax or HAVE_VOLVA to be fired. This helps prune the mushrooms classification tree when the particular mushroom is in three of these families: Bolbitiaceae, Cortinariaceae, or Paxiliaceae.
HAVE_VOLVA 
contains the third answer of a user answer list, whether the mushroom has VOLVA, and it will cause either STROPHARIACEAE or HAVE_RING or COPRINACEAE or RHODOPHYLLACEAE or GOMPHIDIACEAE to be fired. This helps prune the mushrooms classification tree when the particular mushroom is in these families: STROPHARIACEAE, COPRINACEAE, RHODOPHYLLACEAE or GOMPHIDIACEAE.
HAVE_RING 
contains the last answer of a user answer list, whether the mushroom has RING, and it will cause either RusHygTri or  AMANITACEAE or CHECK or LEPIOTACEAE to be fired. This helps prune the mushrooms classification tree when the particular mushroom is in these families: Russulaceae, Hygrophoraceae, Lepiotaceae, AMANITACEAE, or Tricholomataceae, 
CHECK 
causes either QUIT or  AGARICACEAE or VOLVARIACEAE to be fired. 
NO_GILLS 
is fired if the particular mushroom has NO GILLS, which means this mushroom is not an Agarics. This will save time from asking useless questions.

        The remaining11 rules are the domain knowledge of this system : BolCorPax, STROPHARIACEAE, RHODOPHYLLACEAE, GOMPHIDIACEAE, COPRINACEAE, RusHygTri, LEPIOTACEAE, AMANITACEAE, AgaStrVolRho, AGARICACEAE, and VOLVARIACEAE. In each rule contains questions and information related to the mushrooms in its family. This way of coding can help the developer to add new knowledge or update the knowledge easily and It is also easy for programmers to reuse the code.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;  VOLVARIACEAE after HAVE_RING assert (check-volvariaceae) into the facts,
; and it will check information about mushrooms in volvariaceae family
; pre-cond : after HAVE_RING
; pro-cond : causes QUIT to be fired
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defrule VOLVARIACEAE "check information about mushrooms in volvariaceae family"
 (check-volvariaceae)
=>
 (printout t crlf "Is it have pink ovoid spores and campanulate to covex cap shape" crlf
                  " yellowish-white fibrillose dry cap, free crowded whitish gills? Y/N ")
 (if (eq (read) y) then
        (printout t crlf"This mushroom is an Volvariella surrecta.")
       (printout t crlf" Volvariella surrecta is not RECOMMENDED." crlf crlf)
       (assert (end))
 else
      (printout t crlf "Is it have pink ellipsoid smooth spores and" crlf
                       "viscid smooth margin not striate white or slightly" crlf
                       "graying-tinged cap? Y/N " )
      (if (eq (read) y) then
                   (printout t crlf"This mushroom is an Volvariella speciosa.")
                   (printout t crlf"Volvariella speciosa is not RECOMMENDED." crlf crlf)
                  (assert (end))
     else
              (printout t crlf"This Mushrooms is not one of 33 Agarics."crlf)
              (printout t "From the information, it may be a mushroom in" crlf
                           "Volvariaceae family" crlf)
              (assert (end))
         )
    )
)

        Mushrooms can be classified by using several ways [4] [9]. I mainly used clasification techniques from the book named "Mushrooms of Western North America" [3]. The most important is that an agarics must have gills.  The characteristics of the gills, spore, cap, pileus, stipe, veils, and universal veil are used in this system in order to indentify a mushroom. Fiqure 3, 4, 5, and 6 show the various types of each part of a mushroom.

Figure 3 List of cap shape [3]

Figure 4 List of spore type [3]

Figure 5 List of cap shapes [3]

Figure 6 List of stalk type [3]


 

A sample run

This is the introduction and the first question that the system will ask users.

///////////////////////////////////////////////////////////////////////////
NOTE : This system is just a tool to help you classify Agarics.
       Since deadly poisons are found in many species of the genera
       Amanita and Gelerina which are grouped under the Agarics, it is
       your responsibility not to experiment with mushrooms that you
       cannot positively identify.
///////////////////////////////////////////////////////////////////////////

Welcome to the Is-One-of-33-Agarics Expert System
==============================================================

Take a good look at your mushroom and answer the following questions

Does it have gills? Y/N _

Then users have to type either Y/y for YES or N/n for NO
Does it have gills? Y/N  y

What is the color of the spores? a, b, c, d, or e
a) purplish-brown to chocolate-brown
b) pink to salmon
c) ochre, clay-color or brown
d) black to smoky-gray
e) white, yellowish, or pinkish-buff
Answer is _

At this point users have to select a/A, b/B, c/C, d/D, or e/E
What is the color of the spores? a, b, c, d, or e
a) purplish-brown to chocolate-brown
b) pink to salmon
c) ochre, clay-color or brown
d) black to smoky-gray
e) white, yellowish, or pinkish-buff
Answer is a

What is the type of gills?
a) free
b) adnate
c) adnexed
d) decurrent
Answer is a

Does it have a volva? Y/N  n

Does it have a ring? Y/N_

The system keeps asking you questions because there is not enough information for the system to give an answer. Assume that you have a diferent answer set.
What is the color of the spores? a, b, c, d, or e
a) purplish-brown to chocolate-brown
b) pink to salmon
c) ochre, clay-color or brown
d) black to smoky-gray
e) white, yellowish, or pinkish-buff
Answer is e

What is the type of gills?
a) free
b) adnate
c) adnexed
d) decurrent
Answer is b

Does it have a volva? Y/N  n

This Mushrooms is not one of 33 Agarics.
From the information, it may be a mushroom in
Russulaceae family or
Hygrophoraceae family or
Tricholomataceae family
 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Do you want to Exit? Y/N  _

The system gives an answer right a way when it has collected enough information to identify a particular mushroom. Then the system asks whether or not users want to Exit.

If the answer is yes.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Do you want to Exit? Y/N y

======================================
Thank you for using this program.
Good-bye
@^_^@

CLIPS>_

If the answer is no, the command reset in the REPEAT rule is seted and the system starts with the INTRO rule.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Do you want to Exit? Y/N n

///////////////////////////////////////////////////////////////////////////
NOTE : This system is just a tool to help you classify Agarics.
       Since deadly poisons are found in many species of the genera
       Amanita and Gelerina which are grouped under the Agarics, it is
       your responsibility not to experiment with mushrooms that you
       cannot positively identify.
///////////////////////////////////////////////////////////////////////////

Welcome to the Is-One-of-33-Agarics Expert System
==============================================================

Take a good look at your mushroom and answer the following questions

Does it have gills? Y/N _

Full version of this output is in Agarics1.out

 

A sample run of possible error situations

If the answer is not the answer the system expected, the system will terminate.
For example,
    if an answer has to be "y" or "n" and users answer "b" the system will terminate.

What is the color of the spores? a, b, c, d, or e
a) purplish-brown to chocolate-brown
b) pink to salmon
c) ochre, clay-color or brown
d) black to smoky-gray
e) white, yellowish, or pinkish-buff
Answer is s

CLIPS>

If the user types "s" instead of a, b, c, d or e, and "s" is not an answer that the system expects the system terminates. and returns to the CLIPS> prompt.
Full version of this output is in Agarics2.out

 

The system limitations

There are two possible errors that might occur during a run-time of this program. (more details on A sample run of possible error situations)

One more thing that I am concerning is that there are a lot of mushroom parts and names that users need to know such as the names for mushroom cap shapes. It is better for users to use the pictures from the reference of this program in order to understand the question and pick the best answer.

 

The Future Work

        Since the program does not show pictures it might be hard for the users. This sytem uses a lot of shapes, color, and charecteristic of several parts of a mushroom. The text-based is a little bit hard for users because the questins is not clear enoght. For example, what is called "pink to salmon" color in this system, what is "campanulate to covex" cap shape.

       The furture work of this program is developing the graphic-based system added pictures and helpfull information such as the color shade, the various shapes. This technique will improve this expert system in terms of User-Interface and User-Friendly.

 

The Information of 33 Agarics