Artificial Intelligence (AI) is a field within computer science with the goal of recreating, through the user of a computer, the intelligence we see in human behavior. The goal of AI has yet to be achieved on a broad sense, but much progress has been made in the fields of logic and categorization. We tackled deductive reasoning last class with logic puzzles, deducing a conclusion of what must be true from the facts presented to us. Today we'll focus on inductive logic: our ability to make generalizations based on data and apply these general rules to new situations.
edible? | gill_spacing (in mm) | cap_shape | color | bruises | ring_number |
---|---|---|---|---|---|
edible | 10 | "flat" | "gray" | True | 2 |
edible | 17 | "conical" | "gray" | False | 0 |
edible | 2 | "sunken" | "brown" | True | 1 |
edible | 15 | "knobbed" | "gray" | False | 2 |
edible | 1 | "conical" | "brown" | True | 0 |
poisonous | 4 | "flat" | "red" | True | 0 |
poisonous | 8 | "bell" | "brown" | False | 1 |
poisonous | 26 | "knobbed" | "red" | False | 0 |
poisonous | 19 | "flat" | "yellow" | False | 1 |
poisonous | 4 | "knobbed" | "brown" | False | 1 |
Imagine you are tasked by the Audobon Society to develop an electronic field guide on mushrooms. They present you with the following ten example mushrooms above, listing a few of their attributes. The most important category is if a mushroom is edible or not, however, this is the only category you cannot directly observe from the mushroom without eating it. The would like a way to make decisions about newly found mushrooms which is based on the information above, and simple enough for someone to remember the edible rule even without the field guide.
Using what you know about if-elif-else
statements, write a python program called
mushroom_detector.py
. First, ask the user to input the data they observe on a
single mushroom, using gill_spacing
, cap_shape
, color
,
bruises
and ring_number
. Using this data, construct four
if-elif-else statements that will correctly categorize all of the above training data mushrooms,
using the following restrictions for each statement:
mushroom_detector.py> program with the following data. What is the predicted
value for edible/poisonous for each mushroom on each statement?
Table of Mushrooms Test Data
gill_spacing (in mm) cap_shape color bruises ring_number
4 "sunken" "red" False 1
13 "bell" "red" True 2
What To Hand In
Log in to cs.centenary.edu
through either Secure FTP or WinSCP using your
cs login and password. Create a subdirectory from csc104
called lab4
and make it read, write and execute privileges for only the
owner. Write up your four if-elif-else statements from step 1 and the results of
each test example with each if-elif-else statement above into a file called
lab4_evaluation.txt
and copy it into this directory.
You must hand in:
- mushroom_detector.py
- lab4_evaluation.txt
© Mark Goadrich 2007, Centenary College of Louisiana