Tool-life prediction for CNC lathes
The plants replaced cutting tools when a piece counter ran out. I rebuilt the prediction pipeline in Python to test whether the machine logs could time those replacements better. The data covered two plants: 52 million raw log rows, of which 34 million remained after cleaning.
−26%per-tool error on remaining life
Mean absolute error per tool on remaining life, as a fraction of the tool's preset life. Lower is better.
Method and results
- Validation used cycle-grouped splits over 5 and 20 seeds, a time-based split, walk-forward folds and leave-one-machine-out.
- At both plants the counter fell at the same rate early and late in a tool's life, and it was almost uncorrelated with spindle load (r = −0.02 and −0.07). It counts pieces against a quota. I therefore reframed the system as decision support for tool changes.
- XGBoost alone reduced error by about 15% against the previous model, on 5 of 5 seeds. Excluding one machine with a frozen counter accounts for the rest.
- Adding the raw counter as a feature drives error down to about 0.01. That accuracy comes from leakage, so the feature stays out of the model.
- For detecting faulty counters, a simple rule outperformed my own ML monitor (precision and recall of 1.00, against 0.60 and 0.95). I recommended the rule.
- The handover included a shop-floor trial plan for running tools longer, since only a controlled trial can show whether that is safe.