Skip to content

Mushroom classifier/issue#1714 - #1723

Merged
UTSAVS26 merged 2 commits into
UTSAVS26:mainfrom
archangel2006:Mushroom-Classifier/issue#1714
Aug 23, 2025
Merged

UTSAVS26 merged 2 commits into
UTSAVS26:mainfrom
archangel2006:Mushroom-Classifier/issue#1714

Conversation

@archangel2006

@archangel2006 archangel2006 commented Aug 22, 2025 •

Copy link
Copy Markdown
Contributor

Pull Request for PyVerse 💡

Requesting to submit a pull request to the PyVerse repository.


Issue Title

Please enter the title of the issue related to your pull request.
[Code Addition Request]: Mushroom Classifier (KNN, RandomForest, LogisticRegression) #1714

  • I have provided the issue title.

Info about the Related Issue

What's the goal of the project?
To classify mushrooms as edible (e) or poisonous (p) based on their categorical features. The goal is to build a robust model that generalizes well and can assist in safe mushroom identification.
Comparing and evaluating three classification models:

  • K-Nearest Neighbors (KNN)

  • Logistic Regression

  • Random Forest
    Evaluation metrics such as accuracy, precision, recall, and F1-score are used to compare model performance.

  • I have described the aim of the project.


Name

Please mention your name.
Vaibhavi Srivastava

  • I have provided my name.

GitHub ID

Please mention your GitHub ID.
archangel2006

  • I have provided my GitHub ID.

Email ID

Please mention your email ID for further communication.
26.archangel@gmail.com

  • I have provided my email ID.

Identify Yourself

Mention in which program you are contributing (e.g., WoB, GSSOC, SSOC, SWOC).
Contributor SSoC25

  • I have mentioned my participant role.

Closes

Enter the issue number that will be closed through this PR.
Closes: #1714

  • I have provided the issue number.

Describe the Add-ons or Changes You've Made

Give a clear description of what you have added or modified.
Added Files in Mushroom Classification (new folder created) : Mushroom Classifier (KNN, RandomForest, LogisticRegression).ipynb , mushrooms.csv , README.md for the project

  • I have described my changes.

Type of Change

Select the type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Describe how your changes have been tested.
All cells have been run on colab notebook

  • I have described my testing process.

Checklist

Please confirm the following:

  • My code follows the guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly wherever it was hard to understand.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added things that prove my fix is effective or that my feature works.
  • Any dependent changes have been merged and published in downstream modules.

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive README for the Mushroom Classification project. It covers objectives, dataset overview, EDA highlights (distributions, correlations), preprocessing steps (encoding, split, scaling), and a side-by-side model comparison (KNN, Logistic Regression, Random Forest) with accuracy, precision, recall, and F1-score. Summarizes results noting perfect accuracy for KNN and Random Forest, provides reasoning for model preference, and includes author attribution and reference links for further exploration.

Mushroom Classifier (KNN, RandomForest, LogisticRegression)
Mushroom Classifier (KNN, RandomForest, LogisticRegression).ipynb , mushrooms.csv
@coderabbitai

coderabbitai Bot commented Aug 22, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a new README at Machine_Learning/Mushroom Classification/README.md describing a Mushroom Classification project, dataset, preprocessing (label encoding, train/test split, scaling), and model evaluation for KNN, Logistic Regression, and Random Forest with reported metrics and a brief summary.

Changes

Cohort / File(s) Summary
Documentation: Mushroom Classification README
Machine_Learning/Mushroom Classification/README.md
Added project README detailing objective, dataset, EDA outline, preprocessing steps, models (KNN, Logistic Regression, Random Forest), evaluation metrics, comparative results, and author info.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Assessment against linked issues

Objective Addressed Explanation
Implement classifiers and training/evaluation pipeline [#1714] ❌ Only documentation added; no implementation files.
Compute and report evaluation metrics programmatically (accuracy, precision, recall, F1) [#1714] ❌ Metrics are described in text; no code present.
Provide code for data preprocessing (encoding, split, scaling) and model comparison [#1714] ❌ Preprocessing and comparison described, but no executable code provided.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Added standalone README documentation (Machine_Learning/Mushroom Classification/README.md) Issue requests code addition for classifiers; this PR adds documentation only, without accompanying implementation.

Suggested labels

Contributor, Beginner, SSoC25

Suggested reviewers

  • TheChaoticor
  • UTSAVS26

Poem

In clovered labs I twitch my nose,
To classify where mushroom grows—
KNN hops, the Forest hums,
Logistic taps on data drums.
Though code is shy, the tale is clear,
I thump my paw: “The models near!”
🐇🍄

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions

Copy link
Copy Markdown

👋 Thank you for opening this pull request! We're excited to review your contribution. Please give us a moment, and we'll get back to you shortly!

Feel free to join our community on Discord to discuss more!

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions github-actions Bot added Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. Intermediate SSoC25 Status: Review Ongoing 🔄 PR is currently under review and awaiting feedback from reviewers. labels Aug 22, 2025
@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

17 similar comments
@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

2 similar comments
@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@github-actions

Copy link
Copy Markdown

✅ PR validation passed! Syncing labels and assignees from the linked issue...

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (5)
Machine_Learning/Mushroom Classification/README.md (5)

1-3: Tighten intro (trailing space, minor formatting).

  • Line 1 has a trailing space after the heading.
  • Consider adding a one-line “What’s inside” summary to anchor readers.

Apply:

-# 🍄 Mushroom Classification 
+# 🍄 Mushroom Classification
+
+Builds and compares KNN, Logistic Regression, and Random Forest to classify mushrooms as edible (e) or poisonous (p).

66-73: Results table: specify averaging, seeds, and add CV; interpretation wording.

  • State averaging for precision/recall/F1 (macro/micro/weighted). Common: weighted for class imbalance or macro for parity.
  • Report split seed and optionally 5-fold CV mean ± std to reduce variance.
  • Column header casing (“interpretation”) and phrasing could be more specific.
-| Model               | Accuracy | Precision | Recall | F1-Score | interpretation |
+| Model | Accuracy | Precision (macro) | Recall (macro) | F1-Score (macro) | Interpretation |

Add below the table:

+Notes:
+- Metrics computed on a stratified 20% hold-out (random_state=42). For robustness, also report 5-fold CV mean ± std on the training set.

Also verify LR preprocessing; with proper one-hot, LR typically reaches near-perfect on this dataset. Re-run to confirm whether 94.77% persists.


76-84: Add a clear safety disclaimer.

Even with 100% test accuracy, readers should not use this model for real-life foraging decisions.

 📌 In practical applications, **Random Forest** is preferred due to efficiency and robustness.
+
+> Safety disclaimer: This project is for educational purposes only and must not be used to identify wild mushrooms for consumption.

86-90: Add License & Citation section.

Include project license and credit the dataset provider(s).

 GitHub: [archangel2006](https://github.com/archangel2006/)
 
+---
+## 📄 License & Citation
+
+- Code license: MIT (or repository’s default). Update if different.
+- Data: “Mushroom” dataset from the UCI Machine Learning Repository. If using the Kaggle mirror, also cite the Kaggle dataset page. Review and comply with dataset terms.

49-55: EDA: treat "?" as unknowns; clarify "correlation" for categorical features.

Found evidence: the notebook includes "?" placeholders (stalk-root). Recommend updating README to note handling of "?" and to use a precise association measure for categorical features.

Files to update:

  • Machine_Learning/Mushroom Classification/README.md (EDA section, lines ~49–55)
  • Machine_Learning/Mushroom Classification/Mushroom Classifier (KNN, RandomForest, LogisticRegression).ipynb — shows "stalk-root: ['e' 'c' 'b' 'r' '?']" (ipynb:1266)

Suggested diff:

- - Checked shape, data types, null values (none found).
+ - Checked shape, dtypes, null values, and “?” placeholders for unknowns (e.g., stalk-root contains '?') — treat/encode these as missing during preprocessing.
...
- - Visualized correlation between selected categorical features and class.
+ - Assessed association between categorical features and class using chi-square / Cramér’s V (or mutual information) rather than an ambiguous "correlation" term.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0c1a6d1 and bf656b4.

⛔ Files ignored due to path filters (1)
  • Machine_Learning/Mushroom Classification/mushrooms.csv is excluded by !**/*.csv
📒 Files selected for processing (1)
  • Machine_Learning/Mushroom Classification/README.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
Machine_Learning/Mushroom Classification/README.md

[grammar] ~1-~1: There might be a mistake here.
Context: # 🍄 Mushroom Classification This project builds and compares multiple...

(QB_NEW_EN)


[grammar] ~10-~10: There might be a mistake here.
Context: ... evaluating three classification models: - K-Nearest Neighbors (KNN) - Logistic Reg...

(QB_NEW_EN)


[grammar] ~11-~11: There might be a mistake here.
Context: ...tion models: - K-Nearest Neighbors (KNN) - Logistic Regression - Random Forest … a...

(QB_NEW_EN)


[grammar] ~12-~12: There might be a mistake here.
Context: ...st Neighbors (KNN) - Logistic Regression - Random Forest … and determine which per...

(QB_NEW_EN)


[grammar] ~20-~20: There might be a mistake here.
Context: ...classification. --- ## 📂 Dataset Source: [UCI Mushroom Dataset](https://...

(QB_NEW_EN)


[grammar] ~20-~20: There might be a mistake here.
Context: ...aset Source: UCI Mushroom Dataset Target Variable: class (e = edible, p...

(QB_NEW_EN)


[grammar] ~25-~25: There might be a mistake here.
Context: ...= poisonous) Features : - cap-shape - cap-surface - cap-color - bruises - odor...

(QB_NEW_EN)


[grammar] ~26-~26: There might be a mistake here.
Context: ...Features : - cap-shape - cap-surface - cap-color - bruises - odor - gill-attach...

(QB_NEW_EN)


[grammar] ~27-~27: There might be a mistake here.
Context: ...** - cap-shape - cap-surface - cap-color - bruises - odor - gill-attachment - gill-...

(QB_NEW_EN)


[grammar] ~28-~28: There might be a mistake here.
Context: ...hape - cap-surface - cap-color - bruises - odor - gill-attachment - gill-spacing - ...

(QB_NEW_EN)


[grammar] ~29-~29: There might be a mistake here.
Context: ...cap-surface - cap-color - bruises - odor - gill-attachment - gill-spacing - gill-si...

(QB_NEW_EN)


[grammar] ~30-~30: There might be a mistake here.
Context: ...color - bruises - odor - gill-attachment - gill-spacing - gill-size - gill-color ...

(QB_NEW_EN)


[grammar] ~31-~31: There might be a mistake here.
Context: ... - odor - gill-attachment - gill-spacing - gill-size - gill-color - stalk-shape -...

(QB_NEW_EN)


[grammar] ~32-~32: There might be a mistake here.
Context: ...ll-attachment - gill-spacing - gill-size - gill-color - stalk-shape - stalk-root ...

(QB_NEW_EN)


[grammar] ~33-~33: There might be a mistake here.
Context: ... - gill-spacing - gill-size - gill-color - stalk-shape - stalk-root - stalk-surface...

(QB_NEW_EN)


[grammar] ~34-~34: There might be a mistake here.
Context: ...- gill-size - gill-color - stalk-shape - stalk-root - stalk-surface-above-ring - ...

(QB_NEW_EN)


[grammar] ~35-~35: There might be a mistake here.
Context: ... gill-color - stalk-shape - stalk-root - stalk-surface-above-ring - stalk-surface...

(QB_NEW_EN)


[grammar] ~36-~36: There might be a mistake here.
Context: ... - stalk-root - stalk-surface-above-ring - stalk-surface-below-ring - stalk-color-a...

(QB_NEW_EN)


[grammar] ~37-~37: There might be a mistake here.
Context: ...ce-above-ring - stalk-surface-below-ring - stalk-color-above-ring - stalk-color-bel...

(QB_NEW_EN)


[grammar] ~38-~38: There might be a mistake here.
Context: ...face-below-ring - stalk-color-above-ring - stalk-color-below-ring - veil-type veil-...

(QB_NEW_EN)


[grammar] ~39-~39: There might be a mistake here.
Context: ...olor-above-ring - stalk-color-below-ring - veil-type veil-color - ring-number - rin...

(QB_NEW_EN)


[grammar] ~40-~40: There might be a mistake here.
Context: ...ing - stalk-color-below-ring - veil-type veil-color - ring-number - ring-type - s...

(QB_NEW_EN)


[grammar] ~40-~40: There might be a mistake here.
Context: ...-color-below-ring - veil-type veil-color - ring-number - ring-type - spore-print-co...

(QB_NEW_EN)


[grammar] ~41-~41: There might be a mistake here.
Context: ...ing - veil-type veil-color - ring-number - ring-type - spore-print-color - populati...

(QB_NEW_EN)


[grammar] ~42-~42: There might be a mistake here.
Context: ...ype veil-color - ring-number - ring-type - spore-print-color - population - habitat...

(QB_NEW_EN)


[grammar] ~43-~43: There might be a mistake here.
Context: ...g-number - ring-type - spore-print-color - population - habitat --- ## 🔍 Explora...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...ng-type - spore-print-color - population - habitat --- ## 🔍 Exploratory Data Ana...

(QB_NEW_EN)


[grammar] ~50-~50: There might be a mistake here.
Context: ...## 🔍 Exploratory Data Analysis (EDA) - Checked shape, data types, null values (n...

(QB_NEW_EN)


[grammar] ~50-~50: There might be a mistake here.
Context: ...lysis (EDA) - Checked shape, data types, null values (none found). - Examined cla...

(QB_NEW_EN)


[grammar] ~51-~51: There might be a mistake here.
Context: ...data types, null values (none found). - Examined class distribution – fairly bala...

(QB_NEW_EN)


[grammar] ~51-~51: There might be a mistake here.
Context: ...ed class distribution – fairly balanced. - Analyzed frequency of each feature's uni...

(QB_NEW_EN)


[grammar] ~52-~52: There might be a mistake here.
Context: ...equency of each feature's unique values. - Visualized correlation between selected ...

(QB_NEW_EN)


[grammar] ~61-~61: There might be a mistake here.
Context: ...Scaler` (for KNN & Logistic Regression). - All models trained on the same preproces...

(QB_NEW_EN)


[grammar] ~66-~66: There might be a mistake here.
Context: ...comparison. --- ## 🧠 Model Comparison | Model | Accuracy | Precis...

(QB_NEW_EN)


[grammar] ~68-~68: There might be a mistake here.
Context: ...n | Recall | F1-Score | interpretation | |--------------------|----------|-------...

(QB_NEW_EN)


[grammar] ~69-~69: There might be a mistake here.
Context: ...-----------|--------|----------|-------| | KNN | 100% | 1.00 ...

(QB_NEW_EN)


[grammar] ~70-~70: There might be a mistake here.
Context: ... | 1.00 | 1.00 | Great accuracy | | Logistic Regression | 94.77% | 0.94 ...

(QB_NEW_EN)


[grammar] ~71-~71: There might be a mistake here.
Context: ... | 0.94 | Strong linear separator | | Random Forest | 100% | 1.00 ...

(QB_NEW_EN)


[grammar] ~76-~76: There might be a mistake here.
Context: ...robust model | --- ## 🏆 Final Verdict Both KNN and Random Forest achiev...

(QB_NEW_EN)


[grammar] ~83-~83: There might be a mistake here.
Context: ...ferred due to efficiency and robustness. --- ## 👤 Author GitHub: [archangel2006](https:...

(QB_NEW_EN)


[grammar] ~86-~86: There might be a mistake here.
Context: ...ciency and robustness. --- ## 👤 Author GitHub: [archangel2006](https://github.co...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
Machine_Learning/Mushroom Classification/README.md

40-40: Hard tabs
Column: 12

(MD010, no-hard-tabs)

Comment on lines +19 to +23
## 📂 Dataset
**Source:** [UCI Mushroom Dataset](https://www.kaggle.com/datasets/uciml/mushroom-classification)

**Target Variable:** `class` (e = edible, p = poisonous)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Fix dataset attribution and citation (Kaggle mirror vs. UCI source).

The link points to Kaggle but the text says “UCI Mushroom Dataset.” Please credit UCI as the source and note Kaggle as a mirror. Add a brief citation and licensing note to avoid ambiguity.

-## 📂 Dataset  
-**Source:** [UCI Mushroom Dataset](https://www.kaggle.com/datasets/uciml/mushroom-classification) 
+## 📂 Dataset
+**Source:** UCI Machine Learning Repository (Mushroom dataset). Kaggle link below is a mirrored copy.
+  
+- UCI: https://archive.ics.uci.edu/ml/datasets/Mushroom
+- Kaggle mirror: https://www.kaggle.com/datasets/uciml/mushroom-classification
+
+Please review dataset licensing/terms at the source before redistribution.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 📂 Dataset
**Source:** [UCI Mushroom Dataset](https://www.kaggle.com/datasets/uciml/mushroom-classification)
**Target Variable:** `class` (e = edible, p = poisonous)
## 📂 Dataset
**Source:** UCI Machine Learning Repository (Mushroom dataset). Kaggle link below is a mirrored copy.
- UCI: https://archive.ics.uci.edu/ml/datasets/Mushroom
- Kaggle mirror: https://www.kaggle.com/datasets/uciml/mushroom-classification
Please review dataset licensing/terms at the source before redistribution.
**Target Variable:** `class` (e = edible, p = poisonous)
🧰 Tools
🪛 LanguageTool

[grammar] ~20-~20: There might be a mistake here.
Context: ...classification. --- ## 📂 Dataset Source: [UCI Mushroom Dataset](https://...

(QB_NEW_EN)


[grammar] ~20-~20: There might be a mistake here.
Context: ...aset Source: UCI Mushroom Dataset Target Variable: class (e = edible, p...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In Machine_Learning/Mushroom Classification/README.md around lines 19 to 23, the
dataset attribution is ambiguous (linking to a Kaggle mirror but naming UCI as
the source); update the text to clearly credit the UCI Mushroom Dataset as the
original source, mention the Kaggle link as a mirror, and add a short citation
and licensing note (e.g., reference the UCI dataset page and state mirror on
Kaggle, plus any applicable license or usage terms) so readers know provenance
and reuse constraints.

Comment on lines +24 to +45
**Features :**
- cap-shape
- cap-surface
- cap-color
- bruises
- odor
- gill-attachment
- gill-spacing
- gill-size
- gill-color
- stalk-shape
- stalk-root
- stalk-surface-above-ring
- stalk-surface-below-ring
- stalk-color-above-ring
- stalk-color-below-ring
- veil-type veil-color
- ring-number
- ring-type
- spore-print-color
- population
- habitat

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Correct feature list; remove hard tab and split “veil-type/veil-color.”

  • “veil-type veil-color” contains a hard tab (MD010) and merges two features.
  • Normalize punctuation (“Features :” → “Features:”).
  • Keep one item per bullet for grep-ability.
-**Features :**
+**Features:**
 ...
-- veil-type	veil-color
+- veil-type
+- veil-color
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
**Features :**
- cap-shape
- cap-surface
- cap-color
- bruises
- odor
- gill-attachment
- gill-spacing
- gill-size
- gill-color
- stalk-shape
- stalk-root
- stalk-surface-above-ring
- stalk-surface-below-ring
- stalk-color-above-ring
- stalk-color-below-ring
- veil-type veil-color
- ring-number
- ring-type
- spore-print-color
- population
- habitat
**Features:**
- cap-shape
- cap-surface
- cap-color
- bruises
- odor
- gill-attachment
- gill-spacing
- gill-size
- gill-color
- stalk-shape
- stalk-root
- stalk-surface-above-ring
- stalk-surface-below-ring
- stalk-color-above-ring
- stalk-color-below-ring
- veil-type
- veil-color
- ring-number
- ring-type
- spore-print-color
- population
- habitat
🧰 Tools
🪛 LanguageTool

[grammar] ~25-~25: There might be a mistake here.
Context: ...= poisonous) Features : - cap-shape - cap-surface - cap-color - bruises - odor...

(QB_NEW_EN)


[grammar] ~26-~26: There might be a mistake here.
Context: ...Features : - cap-shape - cap-surface - cap-color - bruises - odor - gill-attach...

(QB_NEW_EN)


[grammar] ~27-~27: There might be a mistake here.
Context: ...** - cap-shape - cap-surface - cap-color - bruises - odor - gill-attachment - gill-...

(QB_NEW_EN)


[grammar] ~28-~28: There might be a mistake here.
Context: ...hape - cap-surface - cap-color - bruises - odor - gill-attachment - gill-spacing - ...

(QB_NEW_EN)


[grammar] ~29-~29: There might be a mistake here.
Context: ...cap-surface - cap-color - bruises - odor - gill-attachment - gill-spacing - gill-si...

(QB_NEW_EN)


[grammar] ~30-~30: There might be a mistake here.
Context: ...color - bruises - odor - gill-attachment - gill-spacing - gill-size - gill-color ...

(QB_NEW_EN)


[grammar] ~31-~31: There might be a mistake here.
Context: ... - odor - gill-attachment - gill-spacing - gill-size - gill-color - stalk-shape -...

(QB_NEW_EN)


[grammar] ~32-~32: There might be a mistake here.
Context: ...ll-attachment - gill-spacing - gill-size - gill-color - stalk-shape - stalk-root ...

(QB_NEW_EN)


[grammar] ~33-~33: There might be a mistake here.
Context: ... - gill-spacing - gill-size - gill-color - stalk-shape - stalk-root - stalk-surface...

(QB_NEW_EN)


[grammar] ~34-~34: There might be a mistake here.
Context: ...- gill-size - gill-color - stalk-shape - stalk-root - stalk-surface-above-ring - ...

(QB_NEW_EN)


[grammar] ~35-~35: There might be a mistake here.
Context: ... gill-color - stalk-shape - stalk-root - stalk-surface-above-ring - stalk-surface...

(QB_NEW_EN)


[grammar] ~36-~36: There might be a mistake here.
Context: ... - stalk-root - stalk-surface-above-ring - stalk-surface-below-ring - stalk-color-a...

(QB_NEW_EN)


[grammar] ~37-~37: There might be a mistake here.
Context: ...ce-above-ring - stalk-surface-below-ring - stalk-color-above-ring - stalk-color-bel...

(QB_NEW_EN)


[grammar] ~38-~38: There might be a mistake here.
Context: ...face-below-ring - stalk-color-above-ring - stalk-color-below-ring - veil-type veil-...

(QB_NEW_EN)


[grammar] ~39-~39: There might be a mistake here.
Context: ...olor-above-ring - stalk-color-below-ring - veil-type veil-color - ring-number - rin...

(QB_NEW_EN)


[grammar] ~40-~40: There might be a mistake here.
Context: ...ing - stalk-color-below-ring - veil-type veil-color - ring-number - ring-type - s...

(QB_NEW_EN)


[grammar] ~40-~40: There might be a mistake here.
Context: ...-color-below-ring - veil-type veil-color - ring-number - ring-type - spore-print-co...

(QB_NEW_EN)


[grammar] ~41-~41: There might be a mistake here.
Context: ...ing - veil-type veil-color - ring-number - ring-type - spore-print-color - populati...

(QB_NEW_EN)


[grammar] ~42-~42: There might be a mistake here.
Context: ...ype veil-color - ring-number - ring-type - spore-print-color - population - habitat...

(QB_NEW_EN)


[grammar] ~43-~43: There might be a mistake here.
Context: ...g-number - ring-type - spore-print-color - population - habitat --- ## 🔍 Explora...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...ng-type - spore-print-color - population - habitat --- ## 🔍 Exploratory Data Ana...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)

40-40: Hard tabs
Column: 12

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In Machine_Learning/Mushroom Classification/README.md around lines 24 to 45,
normalize the header punctuation and clean the feature list: change "Features :"
to "Features:", remove the hard tab between "veil-type" and "veil-color" and
split them into two separate bullet items (one feature per line) so each feature
is its own list entry and grep-able; also ensure no trailing spaces and
consistent hyphenation across items.

Comment on lines +58 to +63
## ⚙️ Preprocessing
- Label encoding applied to all categorical variables.
- Train-test split using `train_test_split` (test size = 20%).
- Feature scaling using `StandardScaler` (for KNN & Logistic Regression).
- All models trained on the same preprocessed data for fair comparison.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Preprocessing: avoid ordinal leakage; use per-model pipelines and stratification.

  • Label encoding all categoricals imposes arbitrary order, harming LR/KNN and explaining LR ≈95%.
  • Scale only numeric (or one-hot) features; never scale label-encoded category IDs.
  • Fit transformers on train only; use stratified split with fixed random_state.
- - Label encoding applied to all categorical variables.
- - Train-test split using `train_test_split` (test size = 20%).
- - Feature scaling using `StandardScaler` (for KNN & Logistic Regression).
- - All models trained on the same preprocessed data for fair comparison.
+ - Encoding:
+   - Use `OneHotEncoder(handle_unknown="ignore", sparse_output=False)` for KNN & Logistic Regression.
+   - Random Forest can use one-hot as well (keeps consistency) or `OrdinalEncoder` if desired.
+ - Split: `train_test_split(..., test_size=0.2, stratify=y, random_state=42)`.
+ - Scaling: apply `StandardScaler` only to one-hot/continuous features used by KNN/LR.
+ - Implement per-model `Pipeline` + `ColumnTransformer`, fit on train, transform test to prevent leakage.

If helpful, I can provide a minimal sklearn Pipeline snippet tailored to your notebook.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## ⚙️ Preprocessing
- Label encoding applied to all categorical variables.
- Train-test split using `train_test_split` (test size = 20%).
- Feature scaling using `StandardScaler` (for KNN & Logistic Regression).
- All models trained on the same preprocessed data for fair comparison.
## ⚙️ Preprocessing
- Encoding:
- Use `OneHotEncoder(handle_unknown="ignore", sparse_output=False)` for KNN & Logistic Regression.
- Random Forest can use one-hot as well (keeps consistency) or `OrdinalEncoder` if desired.
- Split: `train_test_split(..., test_size=0.2, stratify=y, random_state=42)`.
- Scaling: apply `StandardScaler` only to one-hot/continuous features used by KNN/LR.
- Implement per-model `Pipeline` + `ColumnTransformer`, fit on train, transform test to prevent leakage.
🧰 Tools
🪛 LanguageTool

[grammar] ~61-~61: There might be a mistake here.
Context: ...Scaler` (for KNN & Logistic Regression). - All models trained on the same preproces...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In Machine_Learning/Mushroom Classification/README.md around lines 58 to 63, the
preprocessing notes are unsafe: label-encoding all categoricals creates
artificial ordinality and can leak information to models like
LogisticRegression/KNN, scaling is being applied to encoded category IDs, and
transformers may be fit on full data without stratification. Fix by performing a
stratified train_test_split(test_size=0.2, random_state=...) on the target, then
build per-model sklearn Pipelines that fit transformers only on the training
fold: for linear models and KNN use OneHotEncoder (or ColumnTransformer) for
categoricals and StandardScaler only on numeric (or on the one-hot outputs if
needed), avoid using ordinal LabelEncoder for features, and ensure all
fit/transform calls happen inside the pipeline so preprocessing is not exposed
to the test set.

@UTSAVS26
UTSAVS26 merged commit 3637432 into UTSAVS26:main Aug 23, 2025
@UTSAVS26 UTSAVS26 added Status: Approved ✔️ PRs that have passed review and are approved for merging. and removed Status: Review Ongoing 🔄 PR is currently under review and awaiting feedback from reviewers. labels Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. Intermediate SSoC25 Status: Approved ✔️ PRs that have passed review and are approved for merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Addition Request]: Mushroom Classifier (KNN, RandomForest, LogisticRegression)

2 participants