Isolation Forest for sensor anomalies: how it works and where it misleads
Read flagged rows in a sensor table by their isolation score, understand what contamination does in the model, and see where the method misleads you.
Why randomly splitting sensor rows can exaggerate real-world performance.
Adjacent readings often share the same conditions. Neighboring windows from one failure event can land in both training and test sets, exposing the event before evaluation. Many rows may still represent only a few independent failures. Report the number of rows, events and assets separately.
For next-month prediction, train on the past and test on a later period. For deployment to new machines, hold out entire machines. Leave a gap when window lengths or prediction horizons overlap the boundary. A single split may not establish both new-asset and new-season generalization.
Fit scaling, imputation and feature selection on training data only. Including the test mean in a scaler leaks future information. Refit the preprocessing pipeline inside each validation fold. Check whether a maintenance outcome field was populated after the moment at which predictions would have been made.
Choose the model, window and alert threshold using validation data. Keep the final test out of those decisions. If the result is poor, development can continue, but repeatedly using that test reduces its independence. Confirm the next release on a newly reserved period.
Do not split sensor rows randomly. When predicting next month, train on the past and test on a later period, and when targeting new machines, hold out entire machines. Leave a gap when window lengths or prediction horizons overlap the boundary, and keep the final test out of model decisions.
Scaling, imputation and feature selection learn statistics from the data they see. If the test mean is included in a scaler, future information reaches training. Refit the preprocessing pipeline inside each validation fold, and check that no maintenance outcome field was filled in after the prediction time.
Pilot steps in this guide are proposed engineering workflows. Examples do not constitute measured field performance.