Built to order

Mushroom Edibility Classifier using ML

This project trains Random Forest and Gradient Boosting classifiers on the UCI mushroom dataset — 8,124 specimens with 22 morphological attributes — to predict whether a mushroom is edible or poisonous. A demo app classifies real field photographs of specimen mushrooms with a verdict, confidence score and the key features that drove the decision, alongside dataset-explorer and model-evaluation views. The training notebook computes accuracy, precision, recall, F1 and the confusion matrix on a held-out split, so every metric in the report comes from the student's own build. Suitable for

Mushroom Edibility Classifier using ML — project thumbnail preview
More project photos (2)

The problem

Every year, foragers are poisoned by wild mushrooms that resemble edible species — and a single wrong call can be fatal. Distinguishing edible from poisonous mushrooms by eye demands expert mycological knowledge that most people simply do not have. The classic UCI mushroom dataset captures that expert knowledge as 22 categorical morphological attributes (odor, gill color, spore print color, cap surface and more) across 8,124 recorded specimens, making it one of the most instructive tabular classification problems in machine learning. This project turns it into a complete student build: Random Forest and Gradient Boosting models trained on the full dataset, wrapped in a demo that classifies specimen mushrooms with explainable feature evidence. The demo shows the real field photographs, the 22-feature vector behind each prediction, and which attributes carried the most weight — so the viva can discuss why odor dominates the decision and where the model can still be wrong.

How it works

  1. The 8,124 UCI mushroom records are loaded and the 22 categorical attributes are one-hot encoded; the edible/poisonous class label is kept as the target.
  2. Data is split 80/20 stratified, preserving the 51.8/48.2 class balance in train and test sets.
  3. A Random Forest (100 estimators) is trained; a Gradient Boosting model (200 rounds) is trained as the comparison baseline.
  4. The notebook evaluates both on the held-out split — accuracy, precision, recall, F1 and the confusion matrix — and logs feature importances.
  5. At inference, the demo app maps a specimen's 22 attributes to the encoded vector, runs the forest, and renders the verdict with confidence and top contributing features.
  6. The demo's dataset and training views read the same CSVs the notebook writes, so every number on screen traces back to the student's build.

Tech stack:

  • Python 3.10, scikit-learn (Random Forest, Gradient Boosting, metrics), pandas, NumPy
  • Matplotlib (class balance, importances, confusion matrix)
  • Single-file HTML/CSS/JS demo app (classifier, dataset explorer, evaluation views)
  • UCI Mushroom Classification dataset (Schlimmer, 1987)
  • Real specimen photographs embedded in the demo
Parameter Value
Models Random Forest (100 estimators) + Gradient Boosting (200 rounds)
Dataset UCI Mushroom: 8,124 instances; 22 categorical features; 4,208 edible / 3,916 poisonous
Input 22 morphological attributes (odor, gill color, spore print, cap surface, ring type, ...)
Output Edible/poisonous verdict, confidence score, top contributing features
Split 80/20 stratified train/test
Training CPU-only; full pipeline runs in minutes on a laptop
Evaluation Accuracy, precision, recall, F1, confusion matrix — computed by the notebook on your build; design target ≈ 99–100% (tree ensembles saturate this dataset)
Inference Milliseconds per specimen; demo runs entirely in the browser

Project features

  • [Specimen classifier] Pick a real photographed specimen and get an edible/poisonous verdict with a confidence bar and the morphological evidence behind it.
  • [Random Forest pipeline] 100-estimator forest on one-hot encoded categorical features; all hyperparameters exposed in the notebook.
  • [Gradient Boosting baseline] A second model for the viva comparison — similar headline accuracy, different training cost and feature-importance story.
  • [Dataset explorer view] Class balance (4,208 edible vs 3,916 poisonous), all 22 attribute definitions, and the near-balanced split that makes accuracy a fair metric.
  • [Feature-importance view] Odor, spore-print color and gill color ranked by the trained models — the classic mycology result, reproduced by the build.
  • [Confusion matrix view] Held-out 20% split results showing exactly where the (rare) errors land.
  • [Safety framing] Every result carries the explicit warning that software output is not food-safety advice — an honest-scope feature examiners respect.
  • [Full evaluation logging] Accuracy, precision, recall, F1 and the confusion matrix computed on the held-out split — never pre-claimed.

What is included

  • Complete source code (preprocessing, encoding, training, evaluation, demo app)
  • Jupyter training and evaluation notebook (buyer-run procedure: train, evaluate, inspect errors)
  • Project report PDF (background, UCI dataset analysis, methodology, evaluation, error analysis)
  • PPT presentation for final review
  • Viva Q&A preparation document (tree ensembles, encoding, feature importance, class balance, evaluation metrics)
  • Setup guide (environment, dataset download, training, running the demo)

Limitations & prerequisites

  • The model classifies from the 22 recorded morphological attributes — it cannot score a photograph alone, and it knows nothing about species outside the UCI encoding.
  • The dataset is from 1987 and covers a limited species set; real-world foraging involves lookalike species the data does not represent.
  • A prediction is statistical, not a safety certificate: the project explicitly refuses the "is it safe to eat" framing and directs users to expert mycologists.
  • Poisonous-class recall matters more than headline accuracy — the report discusses this cost asymmetry and how the threshold was chosen.
  • Near-perfect accuracy on this dataset is expected for tree ensembles; the viva value is in the methodology and honest scope discussion, not in beating a benchmark.

Frequently Asked Questions

Which dataset is used?

The UCI Mushroom Classification dataset (Schlimmer, 1987): 8,124 specimens, 22 categorical morphological attributes, labeled edible (4,208) or poisonous (3,916). It is public, well-documented and a standard teaching dataset.

Which models are used?

A Random Forest (100 estimators) as the primary model and Gradient Boosting (200 rounds) as the comparison baseline — both from scikit-learn, both CPU-friendly.

Is the accuracy guaranteed?

No. Tree ensembles are known to saturate this dataset (design target ≈ 99–100% on the held-out split), but the report documents the accuracy your own training run achieves, not a pre-claimed figure.

Can it tell me if a wild mushroom is safe to eat?

No — and the project says so explicitly. It is a classification exercise on recorded attributes; food-safety decisions need an expert mycologist.

What are the main limitations?

1987 dataset with limited species coverage; needs the 22 attributes, not just a photo; poisonous-class recall is the metric that matters, not headline accuracy.

Is this project suitable for a final-year project?

Yes — for Computer Science, AI/ML and Data Science programs. It demonstrates tabular ML, categorical encoding, ensemble methods, feature importance and honest evaluation, all strong viva material. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Data Science.

Components & software requirements
  • Python 3.10, scikit-learn (Random Forest, Gradient Boosting, metrics), pandas, NumPy
  • Matplotlib (class balance, importances, confusion matrix)
  • Single-file HTML/CSS/JS demo app (classifier, dataset explorer, evaluation views)
  • UCI Mushroom Classification dataset (Schlimmer, 1987)
  • Real specimen photographs embedded in the demo
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download abstract (PDF)

Related guides

All guides
Illustration of object tracking showing video frames with bounding boxes and persistent ID labels following people and vehicles, comparing motion prediction and appearance matching.B.E./B.Tech Computer Science and Electronics students building video analytics projects — people counting, vehicle tracking, sports analysis — who have detection working and need

Object Tracking: DeepSORT and ByteTrack Explained

Detection finds objects per frame; tracking keeps their identities across frames. This guide explains tracking-by-detection, Kalman motion models, DeepSORT's appearance embeddings vs ByteTrack's low-confidence box recovery, tracking metrics (HOTA, IDF1, ID switches), and the tuning parameters that determine real-world quality.

Read guide
Illustration of image segmentation showing U-Net's U-shaped encoder-decoder with skip connections producing pixel masks, alongside Mask R-CNN detecting instances with masks.B.E./B.Tech Computer Science and AI/ML students moving from image classification or detection to pixel-level understanding — medical imaging, defect detection, autonomous driving

Image Segmentation: U-Net and Mask R-CNN

When projects need pixel-level answers, segmentation delivers. This guide explains semantic vs instance vs panoptic segmentation, U-Net's encoder-decoder with skip connections, Mask R-CNN's parallel mask head, Dice and IoU evaluation, paired augmentation, and how to choose the right architecture for your data and question.

Read guide
Illustration of Whisper speech-to-text showing sound waves flowing into a neural network and emerging as transcribed text with timestamps and speaker labels.B.E./B.Tech Computer Science and AI/ML students adding speech-to-text to projects — voice assistants, meeting transcription, accessibility tools

Whisper for Speech-to-Text in Student Projects

Whisper transcribes speech in dozens of languages with no training required. This guide covers how it works, choosing among model sizes, running it locally with faster-whisper, handling hour-long audio, timestamps and speaker diarization, multilingual quirks, and honest evaluation with word error rate.

Read guide
Get a quotation