eyobfikiraddis/plastic-contribution-classifier
0
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
- Access the App: Visit https://eyobfikiraddis-plastic-contribution-classifier.hf.space.
- Upload a CSV File: Provide a CSV file with the required columns (see Dataset Format below).
- View Results: The app displays:
- Random Forest Results: Best parameters, accuracy, precision, recall, classification report, and confusion matrix.
- 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, andmin_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) andcm_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: 8501in this README and restart the Space if needed.
For issues or feedback, contact the Space owner or check the repository for updates.
