EnYa32/steel-plate-defect-prediction
0
๐งฑ Steel Plate Defect Predictor (XGBoost)
This Streamlit app predicts the probability of 7 steel plate defect types:
- Pastry
- Z_Scratch
- K_Scatch
- Stains
- Dirtiness
- Bumps
- Other_Faults
It uses 7 saved XGBoost models (one model per target) and outputs probabilities in the same spirit as the Kaggle submission format.
โ
Files you must have in the same folder as app.py
Models (7 files):
xgb_Pastry.jsonxgb_Z_Scratch.jsonxgb_K_Scatch.jsonxgb_Stains.jsonxgb_Dirtiness.jsonxgb_Bumps.jsonxgb_Other_Faults.json
Metadata:
feature_names.pkl(list of feature columns in the exact training order)target_names.pkl(optional but recommended; list of targets)feature_engineering.json(optional; documentation only)
๐ง Feature Engineering inside the app (same as training)
The app recomputes these engineered features automatically:
area_perimeter_ratio = Pixels_Areas / (X_Perimeter + Y_Perimeter + 1)luminosity_range = Maximum_of_Luminosity - Minimum_of_Luminosity
So your input CSV should contain the raw columns required to compute them (e.g. PixelsAreas, XPerimeter, YPerimeter, MaximumofLuminosity, Minimumof_Luminosity).
โถ๏ธ Run locally
pip install -r requirements.txt
streamlit run app.py
๐ How to use
Option 1: Upload CSV
Upload a CSV containing the raw feature columns (and optionally an id column).
The app will:
compute engineered features
select/reorder features using feature_names.pkl
output probabilities for all 7 targets
allow you to download predictions.csv
Option 2: Single row (manual)
Enter values for the raw features and get a probability table + bar chart.
๐งช Test input example (quick CSV idea)
Create a small CSV with the same raw feature columns as your dataset (like test.csv).
If your file includes id, the app will keep it in the output.
๐ Notes
Probabilities are between 0 and 1.
The model expects the exact same feature order as training (feature_names.pkl ensures this).
If you change feature engineering in the notebook, you must update the Streamlit app accordingly.