Clips Program write-up written by Eric Dietze
Introduction:
This is a forward chaining rule based system design to identify a bird spotted by resident of the West coast of the United States by asking some simple questions. The majority of questions require a answer of "Y" or "N" indicating yes or no. The only exceptions are where I found it more economical in terms of clips script as well as the user's time to just ask what color the bird is rather than say asking "Is it red?", "Is it blue?","Is it green?",etc, also when specifying the size of the bird I thought small and large made more since than yes or no. Of course I had to limit the program in how many `birds it could identify. So I decided to choose the birds of the western coast of the United States.
Background:
I had basically two ideas for an expert system, one was that of a aquarium trouble shooting guide. The second which I actually ended up doing was that of a bird watcher program. The program will ask the user a series of question and then attempt to identify the bird based on the users entries. The information used in this program was gathered by reading "The Beginner's Guide to Birds (Western Region)" which was written by Donald and Lillian Stokes. The first program model asked the user a set number of questions and then matched the facts generated with the questions to the model of the appropriate bird.
Description:
This structure was developed using the restaurant picker program on the class web page as a guide. However this first program had two flaws while not actually fatal during run time seemed undesirable none the less. The initial program model would end up generating a standard set of facts after asking a set list of questions:
What color is the bird: Blue
Is the bird larger than 5 inches: Yes
Does the bird have black or marbled black wings: Black
What color is the face: Black
Does bird have white or yellow streaks above eyes: No
Can the bird hover in mid-air with its wings flapping so fast that it is hard to see them: No
Does the bird have a shiny metal like appearance: No
Does the bird have a red chest: No
Does the bird have a green back: No
Does the bird have a violoet-neck: No
Does the bird have a webbedfeet: No
Does the bird have a greenhead: No
Does the bird have red-eyes: No
What is the beak color: Black
What is the color of the legs: Black
Does the bird have a crest on its head: Yes
birdcolor(blue), birdsize(small),blackormarbledwings(yes), wingcolor(black), facecolor(black), eyebrows(no), hovering(no), metallic-coloring(no), red-chest(no), green-back(no), violet-neck(no), webbedfeet (no), greenhead (no), red-eyes(no), beakcolor (black), legcolor (black), crest(yes)
Script of first program attempt:
printout "Is the bird larger than 5 inches in size?"
assert (big (read))
printout "What is the predominant color of the bird?"
assert (color (read))
printout "Does the bird have either solid black wings or black and white marbled wings?"
assert (blackormarbledwings (read))
printout "What is the color of the birds wings?"
assert (wingcolor (read))
printout "What is the color of the bird's face?"
assert (facecolor (read))
printout "Does the bird have yellow or white eye brows?"
assert (eyebrows (read))
printout "Can bird stay in one place while flying"
assert (hummingbird (read))
printout "Does the bird's coloring appear shiny or metallic?"
assert (metallic (read))
printout "Does the bird have a reddish chest?"
assert (redchest (read))
printout "Does the bird have a green back"
asssert (greenback (read))
printout "Does the bird have a violet neck"
assert (violetneck (read))
printout "Does the bird have webbed feet?"
assert (webbedfeet (read))
printout "Does the bird have an irridescent green head?"
assert (greenhead (read))
printout "Does the bird have red eyes?"
assert (redeyes (read))
printout "What is the color of the beak?"
assert (beakcolor (read))
printout "What is the color of the legs?"
assert (legcolor (read))
printout "Does the bird have a crest on it's head?"
assert (crest (read))
The same number of questions and the same number of facts were asked and generated for every inquiry. There was no search space pruning and while the program structure could accomplish the task, It's structure didn't incorporate any characteristics of the expertise represented by it's rules.
The two flaws with this structure were that it asked more information from the user than was actually necessary. So if enough information had been gathered to determine this bird definitely wasn’t a duck the program would still ask the user "duck questions" which would be totally unnecessary. The second flaw with this approach was not only did it waste the users time but for an AI class having the knowledge represented in the facts alone and not in the structure of the program seemed wrong.
Second Attempt:
So a second program was developed. The questions were the same but the programs would not ask unnecessary questions. For instance the program won’t ask you if the bird has a crest on it’s head unless you have indicated that the bird is over 5 inches in size and blue in color since this question is designed to narrow the candidates between a Stellar Jay , Lazuli Bunting, and a Western Scrub Jay.
The same bird would generate the following questions in the second program.
Is the Bird larger than 5 inches : Yes
What color is the Bird : Blue
Does the bird have iridescent coloring: No
Is bird completely blue: No
Does bird have crest on head : Yes
An illustration of the programs structure is shown below:
New Program Script:
(defrule tweety
(size (small))
(color (yellow))
=>
printout t “Does the bird have an orange beak?” crlf
assert (orangebeak (read)))
(defrule American
(orangebeak (yes))
=>
Printout t “American GoldFinch” crlf
(reset))
(defrule Blackhead
(orangebeak (no))
=>
Printout t “Does the bird have a black head?” crlf
Assert (blackhead (read)))
(defrule YellowWarbler
(blackhead (no))
=>
Printout t “YellowWarbler” crlf
(reset))
(defrule eyebrows
(blackhead (yes))
=>
Printout t “Does bird have either white or yellow eyebrows” crlf
Assert (eyebrow (read)))
(defrule Lesser
(eyebrows(no))
=>
Printout t “Lesser GoldFinch” crlf
(reset))
(defrule CommonYellowThroat
(eyebrows(yes))
=>
Printout t “Common Yellow Throat” crlf
(reset))
(defrule Hummingbird
(color(green))
(size (small))
=>
Printout t “Does bird have a purple throat?” crlf
Assert (purplethroat (read)))
(defrule Rufous
(purplethroat (no))
=>
Printout t “Rufous Humming Bird” crlf
(reset))
(defrule Shiny
(purplethroat (yes))
=>
Printout t “Does the coloring of the bird appear iridescent or metallic” crlf
Assert (Shiny (read)))
(defrule Allen
(Shiny (no))
=>
Printout t “Allen’s Humming Bird” crlf
(reset))
(defrule Purplehead
(Shiny (yes))
=>
Printout t “Does the bird have a purplehead” crlf
Assert (purplehead (read)))
(defrule Anna
(purplehead (yes))
=>
Printout t “Anna’s Humming Bird” crlf
(reset))
(defrule Whitetail
(purplehead (no))
=>
Printout t “Are the edge’s of the tail feathers white” crlf
Assert (whitetail (read)))
(defrule Blackchin
(whitetail (no))
=>
Printout t “Black-chinned Humming Bird” crlf
(reset))
(defrule Broadtail
(whitetail (yes))
=>
Printout t “Broad Tailed Hummingbird” crlf
(reset))
(defrule Redmask
(size (large))
(color (yellow))
=>
Printout t “Does the bird have a reddish mask” crlf
Assert (RedMask (read)))
(defrule Tanager
(RedMask (Yes))
=>
Printout t “Western Tanager” crlf
(reset))
(defrule Blackbody
(RedMask (no))
=>
Printout t “Does bird have a black body?” crlf
Assert (Blackbody (read)))
(defrule Yellowheaded
(Blackbody (yes))
=>
Printout t “Yellow-headed blackbird” crlf
(reset))
(defrule Yelloweyebrows
(Blackbody (no))
=>
Printout t “Does bird have yellow eyebrows” crlf
Assert (Yelloweyebrows (read)))
(defrule MeadowLark
(yelloweyebrows (no)
=>
Printout t “Western MeadowLark” crlf
(reset))
(defrule Blackhead
(yelloweyebrows (yes))
=>
Printout t “Does the bird have a black head” crlf
Assert (Blackhead (read)))
(defrule Oriole
(Blackhead (no))
=>
Printout t “Bullock’s Oriole” crlf
(reset))
(defrule Grosbeak
(Blackhead(yes))
=>
Printout t “Evening Grosbeak” crlf
(reset))
(defrule Duck
(size (large))
(color (green))
=>
Printout t “Does the bird have redeyes?” crlf
Assert (Redeye (read)))
(defrule WoodDuck
(Redeye (yes))
=>
Printout t “Wood Duck” crlf
(reset))
(defrule Mallard
(Redeye (no))
=>
Printout t “Mallard” crlf
(reset))
(defrule Streaks
(size (large))
(color (red))
=>
Printout t “Does the bird have brown streaks on its wings” crlf
Assert (streaks (read)))
(defrule PurpleFinch
(streaks (no))
=>
Printout t “Purple Finch” crlf
(reset))
(defrule HouseFinch
(streaks (yes))
=>
Printout t “House Finch” crlf
(reset))
(defrule BlackFeet
(size (large))
(color (white))
=>
Printout t “Does bird have black feet” crlf
Assert (Blackfeet (read)))
(defrule Cattle
(Blackfeet (no))
=>
Printout t “Cattle Egret” crlf
(reset))
(defrule BlackBeak
(Blackfeet (yes))
=>
Printout t “Does the bird have a black beak?” crlf
Assert (BlackBeak (read)))
(defrule GreatEgret
(BlackFeet (no))
=>
Printout t “Great Egret” crlf
(reset))
(defrule SnowyEgret
(BlackFeet (yes))
=>
Printout t “Snowy Egret” crlf
(reset))
Printout t “Is the Bird bigger than five inches enter large
or small” crlf
Assert (Size (read))
Printout t “Enter the color of the bird” crlf
Assert (Color (read))
Limitations:
Unfortunately I was never able to debug this script to the point where it would run successfully. But I think this program structure has great potential. One drawback is that while the book I used to write this program seemed very informative on birds of the west coast there are bound to be some birds living in the west coast which aren’t covered by this program. Unfortunately this program does not allow for any degree of uncertainty by the user. The user is assumed to have a crystal clear view of the bird in question so there is no “I’m not sure” or “maybe”. Also the program could be made a little deeper in order to make sure the bird is really what the program says it is. For instance as the program is now if a bird has red eyes and is large in size and is green it is considered to be a wood duck. This actually is a pretty safe assumption for the west cost since red eyes are very rare among birds. Still though more questions could be added to confirm this hypothesis. One obvious one that leaps to mind is “Does the bird have a bill?”. Also there is a fact about most birds that makes them difficult to classify. For many species of birds the females and the young tend to be largely gray or brown in color with the obvious coloring of the feathers present only in full grown males.
Goodness:
This program is very accurate in terms of what it sets out to do..classifying the birds of the western coast. If a user gets a good look at a bird and is able to judge it’s size accurately they should be able to get the correct classification of the bird with the minimum amount of questions necessary to make the determination. The user will never become aware of the multitude of questions and rules in the expert system rather they will only see the questions pertinent to the type of bird they saw.
Future Improvements:
Make the program deeper by adding questions to confirm the
path the program is taking. Allow the
program to give the result unknown and also keep a track record as to whether an
unknown with the same characteristics is being seen repeatedly. Make it so that the program can backtrack
should a dead end become apparent. Also
it maybe helpful to include characteristics of the bird’s call so the the user
can use audio clues in addition to visual ones in making the determination,
also it should be possible to narrow down the bird types according to the kind
of habitat in which they live. By using
these two clues together it might be possible to make an educated guess on what
kind of bird you hear without ever actually seeing it.