Associated repository with complementary material to the paper A Multi-Instance Hoeffding Anytime Tree Approach for Interpretable Failure Detection in Industrial Systems, published in Advanced Engineering Informatics. In this repository you will find:
- Source code of the proposed Multi-Instance Hoeffding Anytime Tree
- Datasets used in the experimentation
- Complete tables of results
The aim of the proposal developed in this work is the Time Series Classification in a context of a industrial system under a performance degradation. Due to the intense data generation environment, the model learns in a weak supervised manner.
The code of the proposal has been depeloped in Python >=3.10, using the River library for the base implementation of the Hoeffding Anytime Tree. The complete list of libraries and dependencies of the project is specified in the file requirements.yml.
For a quick start tutorial of the proposal, the tutorial.ipynb describes the complete workflow to start using miHATT, from the loading data process, building and testing the model, and accessing to the interpretability resources.
The complete code generated for this proposal is available under the src folder following the structure:
src
│ requirements.yml
│ tutorial.ipynb
│
└───mihatt.py
│ │ MultiInstanceHATT > Implementation of the proposed method
│
└───utils.py > Auxiliary functions for loading data
│
└───dataprep > Auxiliary functions to prepare the original data for the problem
│ cmapss_preprocess.py
│ cwru_preprocess.py
This work has been tested in two public and popular predictive maintenance problems: NASA Ames Turbofan Engine Degradation Dataset and Case Western Reserve Univeristy Bearing Data Center Ball Bearing Dataset. While original data is available in their corresponding websites, this repository provides access to the processed versions used in this work to perform failure detection applying time series classification. Thus, for each of the two problems, four datasets are considered. These datasets are composed of time series obtained from the sensor measurements of turbofans or rotors during a working session, and in all the cases the target of the learning process will be the grade of degradation of the industrial system, which is a discrete state varying between 3 and 5 grades depending on the dataset.
The following tables show the characteristics of each dataset composing the two case studies. All the files are available for download under the folder datasets.
| Dataset | Train | Test | ||||
|---|---|---|---|---|---|---|
| Sequences per class | Average duration | File | Sequences per class | Average duration | File | |
| FD001 | 33/34/33 | 112.1/143.8/209.1 | FD001_train.csv | 39/32/29 | 102.3/91.6/174.6 | FD001_test.csv |
| FD002 | 86/88/86 | 107.8/144.4/201.7 | FD002_train.csv | 87/82/86 | 82.8/96.5/179.7 | FD002_test.csv |
| FD003 | 33/34/33 | 152.8/177.6/257.8 | FD003_train.csv | 35/32/33 | 122.3/117.8/230.1 | FD003_test.csv |
| FD004 | 83/83/83 | 128.4/158.5/253.8 | FD004_train.csv | 62/104/82 | 109.8/134.6/219.9 | FD004_test.csv |
| Dataset | Train | Test | ||||
|---|---|---|---|---|---|---|
| Sequences per class | Average duration | File | Sequences per class | Average duration | File | |
| DE-IR | 206/203/202/204/200 | 1205.4 | drive_innerrace_train.csv | 206/201/202/201/201 | 1205.4 | drive_innerrace_test.csv |
| DE-BB | 204/203/200/202/201 | 1204.7 | drive_ball_train.csv | 204/202/200/202/202 | 1204.7 | drive_ball_test.csv |
| FE-IR | 205/202/202/200 | 1204.8 | fan_innerrace_train.csv | 203/202/201/200 | 1205.0 | fan_innerrace_test.csv |
| FE-BB | 204/201/201/202 | 1205.8 | fan_ball_train.csv | 204/200/202/201 | 1205.9 | fan_ball_test.csv |
Both Turbofan and Ball bearing datasets have required transformations in order to use them for our problem of failure detection from temporal data using multi-instance learning.
In the case of the NASA Ames Turbofan Engine Degradation Dataset, the original learning target was the prediction of the remaining useful life, i.e. a regression task. Thus, the transformations go in the direction of generating a ground truth that associates each time series with a degradation state. The complete code for the transformation is available in cmapss_preprocess.py.
Attending to the Case Western Reserve University Bearing Data Center Ball Bearing Dataset, the original target is the fault identification directly, but the working sequences are not ready to use in a machine learning environment, as they are separated in different files corresponding to a single complete working sequence. Thus, the transformations consist of splitting the sequences into separate time series, mixing all the degradation states in a single pool, and creating separate sets for training and testing the machine learning models. The complete code for the transformation is availabe in cwru_preprocess.py.
This repository contains the complete tables of results from the experimental study presented in the paper, downloadable from the results folder.
The study is organized in three main parts:
- Analysis of components of the proposed MIHATT
- Comparative performance with the state of the art
- Interpretability study
Each study is fully described in the paper, and below we describe the downloable materials for them.
This analysis evaluates the influence of the main components of the proposed framework: multi-instance formulation, the use of Hoeffding Anytime Tree, and the incremental feature extraction through iterative learning.
The table below contains the average results for each possible combination of components over the eight datasets considered.
| MIL+HATT | SIL+HATT | SIL+FE+HATT | MIL+HT | SIL+HT | SIL+FE+HT | |
|---|---|---|---|---|---|---|
| FD001 | 0.75 | 0.35 | 0.62 | 0.56 | 0.47 | 0.62 |
| FD002 | 0.784314 | 0.360784 | 0.501961 | 0.443137 | 0.45098 | 0.603922 |
| FD003 | 0.68 | 0.44 | 0.59 | 0.43 | 0.35 | 0.59 |
| FD004 | 0.665323 | 0.399194 | 0.528226 | 0.403226 | 0.342742 | 0.592742 |
| DE-BB | 0.935454 | 0.631431 | 0.840973 | 0.54537 | 0.88681 | 0.974743 |
| DE-IR | 1 | 0.701636 | 0.998075 | 0.716073 | 0.947064 | 1 |
| FE-BB | 0.997664 | 0.751168 | 0.871495 | 0.849299 | 1 | 0.913551 |
| FE-IR | 0.997567 | 0.742092 | 1 | 0.875912 | 0.941606 | 1 |
From these results we can get statistics about the average performance across datasets:
bar plot of average performance for each component in MIHATT
And we can estimate as well the contribution of each component, measured as the average gain when introducing MIL, HATT and incremental learning respectively.
bar plot of the effect estimation of each component in MIHATT
The second study compares MIHATT performance against a selection of methods that have been used before for failure prediction in the context of predictive maintenance. These methods are configured following authors recommendations as listed below (more information in the paper).
| Method | Configuration | Reference |
|---|---|---|
| MIHATT | milwindow=0.21, milstride=0.02, k=2, graceperiod=6.7%, delta=2.5e-3, splitcriterion=InfoGain, tau=0.5, leafpred=NaiveBayesAdaptive | Ours |
| MIHT | milwindow=0.21, milstride=0.13, k=4, graceperiod=366.5%, delta=5.6e-3, splitcriterion=InfoGain, tau=0.5, leafpred=NaiveBayesAdaptive | Esteban2025 |
| miSVM | milwindow=0.1, milstride=0.0, C=1.0, kernel=RBF, degree=3, gamma=scale, coef0=0.0, shrinking=True, tol=0.001, classweight=None, maxiter=-1 | Murray2005 |
| miNB | milwindow=0.1, milstride=0.0, estimation=Gaussian | Murray2005 |
| miRF | milwindow=0.1, milstride=0.0, estimators=10, criterion=Gini, maxfeatures=sqrt, minimpuritydecrease=0.0, bootstrap=True, oobscore=False, ccpalpha=0.0, monotoniccst=None | Bakdi2022 |
| miLSTM | milwindow=0.1, milstride=0.0, structure=LSTM(8) layer - dropout(0.8) - Conv1D layer - Batch normalization - RELU activation - output layer(softmax), optimizer=Adam(1e-5) | Wang2021, Janakiraman2018 |
| TimeMIL | structure=InceptionTime backbone - wavelet positional encoding - MHSA/Nystrom MIL pooling(2 layers, 8 heads) - CLS-token aggregation - dense-ReLU-dropout(0.2)-dense classifier - output (softmax), embed=128, dropout_patch=0.5, optim=AdamW(5e-3) | Chen2024 |
| siHTfe | graceperiod=200, delta=1e-7, splitcriterion=InfoGain, tau=0.5, leafpred=NaiveBayesAdaptive | Manju2018, NaveenKumar2019, Balachandar2021, AlameluManghai2019 |
| siDTfe | criterion=Gini, splitter=best, minimpuritydecrease=0.0, ccpalpha=0.0, monotoniccst=None | Esteban2022 |
| siSVMfe | C=1.0, kernel=RBF, degree=3, gamma=scale, coef0=0.0, shrinking=True, tol=0.001, classweight=None, maxiter=-1 | Esteban2022 |
| siNBfe | estimation=Gaussian | Esteban2022 |
| sikNNfe | neighbors=5, weights=uniform, algorithm=brute-force search, leafsize=30, p=2, metric=Euclidean | Esteban2022 |
| siRFfe | estimators=10, criterion=Gini, maxfeatures=sqrt, minimpuritydecrease=0.0, bootstrap=True, oobscore=False, ccpalpha=0.0, monotoniccst=None | Esteban2022 |
| siLSTM | structure=LSTM(8) layer - dropout(0.8) - Conv1D layer - Batch normalization - RELU activation - output layer(softmax), optimizer=Adam(1e-5) | Esteban2022 |
| siTF | adjust_ts=padding, structure=linear input embedding(256) - fixed positional encoding - Transformer encoder(layers=4, heads=4, feedforward=128, BatchNorm, ReLU, dropout=0.1) - masked flattening - output layer(softmax), optimizer=Adam(1e-3) | AlHamed2025 |
The overall average obtained over the eight datasets for each of the 15 proposals included in the study is shown in the next table. In addition, the lower part of the table shows the results of the paired Wilcoxon test resulting from comparing each algorithm against our proposal:
| Metric | MIHATT | MIHT | miSVM | miNB | miRF | miLSTM | TimeMIL | siHTfe | siDTfe | siSVMfe | siNBfe | sikNNfe | siRFfe | siLSTM | siTF |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0.8482 | 0.6029 | 0.2975 | 0.6525 | 0.7189 | 0.2639 | 0.6896 | 0.7869 | 0.7848 | 0.3493 | 0.6859 | 0.7172 | 0.7878 | 0.3588 | 0.3681 | |
| 0.1518 | 0.3971 | 0.7025 | 0.3475 | 0.2811 | 0.7361 | 0.3104 | 0.2131 | 0.2152 | 0.6507 | 0.3141 | 0.2828 | 0.2122 | 0.6412 | 0.6319 | |
| 0.8592 | 0.5831 | 0.1535 | 0.6593 | 0.7199 | 0.1041 | 0.6931 | 0.8096 | 0.8255 | 0.2736 | 0.7160 | 0.7301 | 0.8228 | 0.2911 | 0.3209 | |
| 0.8513 | 0.6028 | 0.3116 | 0.6566 | 0.7221 | 0.2801 | 0.6822 | 0.7834 | 0.7844 | 0.3531 | 0.6838 | 0.7179 | 0.7880 | 0.3660 | 0.3530 | |
| 0.8478 | 0.5756 | 0.1733 | 0.6332 | 0.7045 | 0.1210 | 0.6387 | 0.7744 | 0.7733 | 0.2803 | 0.6784 | 0.7131 | 0.7758 | 0.2380 | 0.2625 | |
| Wilcoxon test | |||||||||||||||
| – | 8 | 8 | 7 | 7 | 8 | 7 | 5 | 6 | 8 | 8 | 7 | 6 | 8 | 8 | |
| – | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 2 | 0 | 0 | 1 | 2 | 0 | 0 | |
|
|
– | 0.0117 | 0.0117 | 0.0180 | 0.0173 | 0.0117 | 0.0180 | 0.0628 | 0.0929 | 0.0117 | 0.0117 | 0.0173 | 0.0929 | 0.0117 | 0.0117 |
The breakdown of the results for each metric is in the results folder, specifically:
MIHATT is naturally explainable thanks to two key aspects: (i) its base learner is a white-box decision tree that has the same input space as the original features, enabling users to trace the reasoning behind each prediction through explicit variable thresholds and decision paths; and (ii) the use of the MIL assumption — combined with the concept of identifying signature patterns within a sequence — makes it possible to highlight the most relevant temporal segment responsible for the predicted class, providing intuitive insight into when and why a failure is likely to occur.
The following table displays information about the trees generated by MIHATT for each studied problem.
| Dataset | height | # nodes | # branches | # leaves |
|---|---|---|---|---|
| FD001 | 12 | 227 | 113 | 114 |
| FD002 | 21 | 1083 | 541 | 542 |
| FD003 | 14 | 257 | 128 | 129 |
| FD004 | 21 | 677 | 338 | 339 |
| drive-ball-1200-05 | 24 | 1321 | 660 | 661 |
| drive-innerrace-1200-05 | 20 | 1227 | 613 | 614 |
| fan-ball-1200-05 | 17 | 649 | 324 | 325 |
| fan-innerrace-1200-05 | 17 | 697 | 348 | 349 |
As example, below there is the graph of the tree generated for the dataset FD001. The nodes display the feature for the decission, that matches the original input space since the model works with the unprocessed features. The branches show the threshold for the given feature at each moment to create the decission path to clasify the sensor data. At the leaves it is shown the probability for each class, i.e., health status considered that range from
For more details about how to load MIHATT, to train it, and to get its interpretability insights, check the tutorial provided in this repository.