# Classifying X-Ray Tube Malfunctions: AI-Powered CT Predictive Maintenance System
## 6 Experiments  
### Methodology  
First, the data were split into 2, in the 80:20 ratio. Afterwards, 5-fold cross-validation was performed on the 80% percent of the data, always training on 4 folds and validating on the 5 th one. This was performed to tune the hyper-parameters and select the best candidate models. Afterwards, these were tested on the 20% per cent test set that was split out initially. All the splits were stratified to account for the class distribution in the dataset despite the rather small imbalance (66:62). The seed was held constant across experiments to make the experiments reproducible.  
As an evaluation metric, accuracy was selected. Before calculating accuracy, every sample was rounded--samples with output of 0.5 and lower were classified as 0 (working), others as 1 (not working). In the case of a binary problem, the micro-f1 score corresponds to the accuracy (as also noted by scikit-learn's documentation ). Hence, we write accuracy/micro F1-score in the tables below, as they are equal. As the dataset is approximately balanced, the calculated macro F1-score would also be very close to this number. As models were evaluated through cross-validation, the reported values are averages through the 5-folds.  
For hyperparameter selection, the optimised parameters were as follows:  
* penalty--In the range of [11, **12** and None]
- c--Parameter related to regularisation strength (inverse), in the range of [0.1, **1**, 10, 100]
* kernels--Selected kernel function, in the range of [**\"rbf\"**, \"linear\", \"poly\"]
- c--Same as for LR (**1**)
- gamma--kernel coefficient, in the range of [0.01, 0.1, 1, 10], base was '**scale'**
* Number of estimators--number of constructed trees, values in [10, **100**, 1000, 10,000]
- Distance criterion--possible values were [**gini**, entropy, log_loss]  
Figure 6: Diagram of used LSTM.  
* Minimal number of samples in leaf nodes--values were in the range of 1-9 with step 2, base was **1**  
* Distance criterion--same as RF
* Minimal number of samples in leaf nodes--same as RF  
* Number of estimators--**[100, 1000, 10,000]
* Subsamples--Ratio of samples used for training base of learners--[0.75, 1], base **1**
* Maximum depth for base learners--[5; 7; 9], base **6**
* Learning rate--[0.1, 0.2], base **0.3**  
Hyperparameters were selected in an exhaustive grid search. GBDT in combination with 10,000 estimators was dropped for the wavelet experiment, as cross-validation took days. The base settings, used for the initial search for AR lag/wavelet shape below, are indicated in bold. The general schema is shown in Figure 7.  
All of our experiments were performed in the Python 3.11 programming language. We utilised Keras 3.9.1 [48] with TensorFlow 2.19.0 [49] backend for neural networks. The scikit-learn [50] library in version 1.6.1 was utilised for classical ML algorithms. For GBDT, we utilised XGBoost 3.0.0 [51] library in order to leverage the parallel implementations. For autoregressive models, we utilised statsmodel [52] library 0.14.4 version and for wavelets,  
Figure 7: Diagram of the model selection scheme.  
we utilised PyWavelets [53] library in version 1.8.0. Figure 5 was visualised through Visualkeras 0.1.4 [54].