Skip to content

About

XGBoost classifier predicting laser weld quality (Good/Spatter/Porosity/Undercut/Cold Weld) with SHAP explainability. Streamlit process window dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Laser Weld Quality Classifier

Python License CI XGBoost Accuracy

XGBoost classifier that predicts laser weld quality outcomes from process parameters, with SHAP explainability to identify which parameter caused each defect. Built for laser welding cells where process engineers need fast, interpretable feedback when quality drops.


Results

Metric Value
Test Accuracy ~93%
Classes 5 (Good / Spatter / Porosity / Undercut / Cold Weld)
Training set 4,800 records (stratified 80/20 split)
Most important feature Laser Power / Travel Speed ratio (energy density)
Inference time < 5 ms per prediction

What it does

Capability Detail
5-class quality prediction Good / Spatter / Porosity / Undercut / Cold_Weld
SHAP waterfall explanation Shows which parameter pushed the prediction toward a defect
Process window map Scatter of power vs speed coloured by quality — see the qualified window visually
Real-time parameter tuning Slider-driven sidebar updates prediction instantly
Confidence scores Per-class probability bar for uncertainty quantification

Quality classes and their physics

Class Root cause
Good Process parameters within the qualified window
Spatter Excessive energy density — molten pool becomes unstable
Porosity Focal offset error or insufficient shielding gas flow
Undercut High power + high speed — groove forms at weld toes
Cold_Weld Insufficient heat input — fusion incomplete

Process parameters

Parameter Unit Typical range
Laser Power W 800–5000
Travel Speed mm/s 10–120
Focal Offset mm −4 to +4
Wire Feed Rate mm/s 20–90
Shielding Gas Flow L/min 5–30
Material Thickness mm 1.5 / 2.0 / 3.0 / 4.0 / 6.0

Quickstart

git clone https://github.com/Jimmply/weld-quality-classifier
cd weld-quality-classifier
pip install -r requirements.txt

# Generate training data
python scripts/generate_data.py

# Train model
python scripts/train.py

# Launch dashboard
streamlit run src/app.py

Project structure

weld-quality-classifier/
├── .github/workflows/ci.yml   # pytest + smoke test
├── config/settings.yaml       # model hyperparameters and thresholds
├── scripts/
│   ├── generate_data.py       # generate and save synthetic dataset
│   └── train.py               # train, evaluate, save model
├── src/
│   ├── data_generator.py      # physics-based rule engine → 6,000 labelled records
│   ├── classifier.py          # XGBClassifier + SHAP TreeExplainer
│   └── app.py                 # Streamlit dashboard with live SHAP waterfall
├── tests/
│   └── test_generator.py
└── requirements.txt

Methodology

Data generation — A physics-informed rule engine assigns defect labels based on normalised energy density (power/speed ratio), focal offset magnitude, and shielding gas flow. Rules are derived from published laser welding process windows for austenitic stainless steel and mild steel. 6,000 records across five material thickness bands.

Modeling — XGBoost with 400 estimators, learning rate 0.04, stratified 80/20 split. Test accuracy: ~93%.

Explainability — SHAP TreeExplainer computes per-prediction feature contributions. The waterfall chart in the dashboard answers the exact question a process engineer asks: "Why did this weld fail, and which knob do I turn?"


Business value

In a production laser welding cell, quality prediction from process parameters (rather than post-weld inspection) enables:

  • In-process correction before a bad part reaches downstream assembly
  • Root cause triage in seconds instead of hours of metallurgical analysis
  • Process window documentation — the model's decision boundary becomes the qualified process window

Tech stack

Python · XGBoost · SHAP · Scikit-learn · Pandas · NumPy · Streamlit · Plotly · Matplotlib


License

MIT © Dmitri Shurkhai

About

XGBoost classifier predicting laser weld quality (Good/Spatter/Porosity/Undercut/Cold Weld) with SHAP explainability. Streamlit process window dashboard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages