While the formal system of Boolean
logic was developed by
George Boole,
the study of logic has roots as far back as Ancient Greece and
Aristotle and his foundational work on
Syllogisms. Our ability to reason
logically and rationally is often cited as a primary indicator of our intelligence, not only on an
individual level as measured by SAT and IQ tests, but also on a species level to distinguish our
actions and behaviors from other organisms. As we search for life in the universe, we
ultimately hope to find intelligent life elsewhere capable of communication; today we will spend
our first lab understanding the basics of intelligence.
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 lab 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.
| Table of Mushroom Training Data | |||||
|---|---|---|---|---|---|
| gill_spacing (in mm) | cap_shape | color | bruises | ring_number | edible? |
| 10 | flat | gray | Yes | 2 | edible |
| 17 | conical | gray | No | 0 | edible |
| 9 | sunken | brown | Yes | 1 | edible |
| 15 | knobbed | red | No | 2 | edible |
| 1 | conical | brown | Yes | 0 | edible |
| 5 | flat | red | Yes | 0 | poisonous |
| 8 | bell | brown | No | 1 | poisonous |
| 24 | knobbed | red | No | 0 | poisonous |
| 16 | flat | yellow | No | 1 | poisonous |
| 4 | knobbed | brown | No | 1 | poisonous |
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. They 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 all the data they observe on a
single mushroom, using gill_spacing, cap_shape, color,
bruises and ring_number. Using this data, construct three
separate tests using 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? Which statement would you recommend using?
| Table of Mushroom Test Data | ||||
|---|---|---|---|---|
| gill_spacing (in mm) | cap_shape | color | bruises | ring_number |
| 4 | sunken | red | No | 1 |
| 13 | bell | red | Yes | 2 |
mushroom_detector.py. Write the results of
each test example in step 2 with each if-elif-else statement above into a Google Doc
and share it with me.
You must hand in: