π Try the Live App π
An interactive machine learning web application built with Streamlit that classifies mushrooms as edible or poisonous using multiple classification algorithms. Users can select different models, tune hyperparameters in real-time, and visualize comprehensive performance metrics.
π Live Demo: https://app-python-jjqwgkziauqderd6t5wprt.streamlit.app/
This project demonstrates an end-to-end machine learning pipeline, from data preprocessing to model deployment. It provides an intuitive interface for comparing three popular classification algorithms and understanding their performance through interactive visualizations.
π Live Application: The app is deployed and accessible at https://app-python-jjqwgkziauqderd6t5wprt.streamlit.app/
Try it yourself - no installation required!
- ποΈ Interactive Model Selection: Choose between SVM, Logistic Regression, and Random Forest classifiers
- βοΈ Real-time Hyperparameter Tuning: Adjust model parameters and see results instantly
- π Comprehensive Metrics: View accuracy, precision, recall, F1-score, and more
- π Dynamic Visualizations:
- Confusion Matrix
- ROC Curve with AUC score
- Precision-Recall Curve
- π― High Performance: Achieves up to 99.8% accuracy with Random Forest
- π Fast Predictions: Instant classification results with optimized models
| Technology | Purpose |
|---|---|
| Python 3.8+ | Core programming language |
| Streamlit | Web application framework |
| Scikit-learn | Machine learning algorithms and metrics |
| Pandas | Data manipulation and analysis |
| NumPy | Numerical computations |
| Matplotlib | Data visualization |
The application uses the UCI Mushroom Dataset, which contains:
- 8,124 samples of mushrooms
- 22 categorical features (cap shape, cap color, odor, gill size, etc.)
- 2 classes: Edible (e) and Poisonous (p)
- No missing values
All categorical features are encoded numerically for machine learning processing.
- Kernel: RBF (Radial Basis Function)
- Tunable Parameters: C (regularization), Gamma
- Best Use: Non-linear classification with clear margins
- Solver: liblinear
- Tunable Parameters: C (regularization)
- Best Use: Fast, interpretable binary classification
- Ensemble Method: Multiple decision trees
- Tunable Parameters: Number of estimators, Max depth, Bootstrap
- Best Use: High accuracy with feature importance insights
- Performance: ~99.8% accuracy on test set
No installation needed! Access the app directly at: π https://app-python-jjqwgkziauqderd6t5wprt.streamlit.app/
- Python 3.8 or higher
- pip (Python package manager)
-
Clone the repository
git clone https://github.com/khadijja1/Streamlit-python.git cd Streamlit-python -
Create a virtual environment (recommended)
# Windows python -m venv venv venv\Scripts\activate # macOS/Linux python3 -m venv venv source venv/bin/activate
-
Install required packages
pip install -r requirements.txt
streamlit run app.pyThe application will open in your default browser at http://localhost:8501
- Select a Classifier from the sidebar (SVM, Logistic Regression, or Random Forest)
- Adjust Hyperparameters using the interactive sliders
- View Results including:
- Classification metrics (accuracy, precision, recall, F1-score)
- Confusion matrix visualization
- ROC curve with AUC score
- Precision-Recall curve
- Compare Models by switching between classifiers and observing performance differences
| Model | Accuracy | Precision | Recall | F1-Score | Training Time |
|---|---|---|---|---|---|
| Random Forest | 99.8% | 99.8% | 99.8% | 99.8% | ~2s |
| SVM | 98.5% | 98.4% | 98.6% | 98.5% | ~5s |
| Logistic Regression | 95.2% | 95.1% | 95.3% | 95.2% | ~1s |
Results may vary based on hyperparameter settings and train/test split
Streamlit-python/
βββ app.py # Main Streamlit application
βββ mushrooms.csv # Dataset
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation
βββ LICENSE # MIT License
βββ .gitignore # Git ignore rules
Contributions are welcome! If you'd like to improve this project:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Khadija
- GitHub: @khadijja1 Scikit-learn contributors for robust ML tools
For questions or feedback, please open an issue on GitHub or reach out through my profile.
β If you found this project helpful, please consider giving it a star! β