Mushroom Classification using Machine Learning

Shravan Adulapuram
Analytics Vidhya
Published in
4 min readOct 23, 2019

A mushroom, or toadstool, is the fleshy, spore-bearing fruiting body of a fungus, typically produced above ground, on soil, or on its food source.

Most of you might have encountered mushrooms that are edible to eat, which are cultivated for consumption nowadays, but a few decades back most of them are wild mushrooms and people used to consume.

Even in today's world, we have a lot of places, where people practice this culture of consuming wild mushrooms but there is an ample number of mushrooms that are poisonous to eat and there are no such specific features that can describe edibility of mushrooms.

This above problem can be solved by using Machine Learning techniques. They can find out what are the features that can describe the class(edible/poisonous) of the mushroom. we took data set from UCI machine learning Repository and did Exploratory Data analysis to solve this problem.

The data set contains below features of the mushroom which can be seen in the image.

There are a lot of myths around mushrooms and their edibility. We did Exploratory Data Analysis on the data set in python to bust those myths.

Top five of those myths are listed below

All white colored mushrooms are edible.

Poisonous mushrooms smell and taste awful.

Poisonous mushrooms always have bright, flashy colors.

All mushrooms that grow in woods, meadows, and pastures are safe to eat.

Poisonous mushrooms have pointy caps.

  1. All white colored mushrooms are safe to eat.

This is the count plot for all the White Mushrooms, and we can observe that there are sizeable amounts of Poisonous Mushrooms which are white in color.

2. Poisonous mushrooms smell and taste awful.

This is the count plot of all poisonous mushrooms and their odor, there are mushrooms that smell good but still, they are toxic.

3. Poisonous mushrooms always have bright, flashy colors.

Here, we can find very few poisonous mushrooms for yellow and cinnamon colors but these are because there are very fewer data points in the data about these colors thus we cannot determine the class exactly.

4. All mushrooms that grow in woods, meadows, and pastures are edible.

It's clear by the graph that this myth is not true as there are poisonous mushrooms in all places.

5. Poisonous mushrooms have pointy caps.

Every cap shape has poisonous mushrooms, here we do not have data for conical shaped mushrooms, but not only for the pointed, knobbed or convex mushrooms.

Further, detailed bi-variant and multi-variant analysis of all features of the mushrooms has also been done. which my friend Prabhat will be sharing in his article which you can find here:- https://medium.com/@prabhathur/mushroom-classification-using-visualization-18f7877e1515

We have also build a customized graph function in python which can automate the process of plotting graphs of any data set at a time.

Tutorial and code link for the customized graph function:- https://youtu.be/m4Noj-o5UXo

Thanks

Shravan A

--

--