CoolFace
Apppublic

eyobfikiraddis/plastic-contribution-classifier

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

Plastic Contribution Classifier

This Space runs a Streamlit app to classify plastic contribution using Random Forest and Isolation Forest models. Upload a CSV file to view model evaluation metrics (accuracy, precision, recall), classification reports, and confusion matrix visualizations for both models.

Usage

  1. 1.Access the App: Visit https://eyobfikiraddis-plastic-contribution-classifier.hf.space.
  2. 2.Upload a CSV File: Provide a CSV file with the required columns (see Dataset Format below).
  3. 3.View Results: The app displays:
  4. 4.Random Forest Results: Best parameters, accuracy, precision, recall, classification report, and confusion matrix.
  5. 5.Isolation Forest Results: Accuracy, precision, recall, classification report, and confusion matrix.

Dataset Format

The CSV file should include the following columns:

  • —Country or Administrative area: The region or country (dropped during processing).
  • —Ratio Me/MPW: A percentage value (e.g., "50%"), converted to a float during processing.
  • —plastic_contribution: The target variable (binary: 0 or 1).
  • —Other numerical features used for classification.

You can download a sample dataset from Google Drive.

Technical Details

  • —Models:
  • —Random Forest: Trained with GridSearchCV to optimize n_estimators, max_depth, and min_samples_split.
  • —Isolation Forest: Uses a contamination rate based on the minority class proportion for anomaly detection.
  • —Dependencies: Listed in requirements.txt (pandas, scikit-learn, matplotlib, seaborn, numpy, streamlit).
  • —Docker: The app runs in a Docker container based on python:3.9-slim, exposed on port 8501.
  • —Output: Confusion matrices are saved as cm_rf.png (Random Forest) and cm_if.png (Isolation Forest).

Troubleshooting

  • —Build Issues: Check the "Logs" tab on the Space page for Docker build errors.
  • —CSV Errors: Ensure the uploaded CSV has the required columns and valid data types.
  • —App Not Loading: Verify the app_port: 8501 in this README and restart the Space if needed.

For issues or feedback, contact the Space owner or check the repository for updates.