# Lab-to-Field Generalization Gap: Assessment of Transfer Learning for Bearing Fault Detection
## 2 Materials and Methods
### Part 4: Features Preparation and Modeling  
The prepared source and target domain datasets were used for binary classification, where Class 0 represented balanced bearing cases and Class 1 included data from four rotor unbalance levels. This resulted in an _imbalanced dataset_, with Class 1 containing four times more samples than Class 0. Since maintaining a _balanced dataset_ is crucial for reliable model performance, _data balancing_ was performed on Class 1 using an undersampling technique [25]. It is important to distinguish between the terms \"balanced\" and \"unbalanced\" when referring to bearing conditions and dataset structure, as \"balanced and unbalanced bearing\" describes the mechanical state of the system, while \"_balanced and imbalanced dataset_\" refers to the class distribution in model training. Random shuffling was applied to the dataset before undersampling to minimize potential bias. The undersampling process could skew the proportion of low- and high-level unbalance samples in the training and test sets, potentially affecting the model performance. Lower-level unbalance is generally more challenging to detect, and model performance could decline if the training set contained fewer low-level unbalance samples, whereas the test set had more. Figure 5: Examples of simulated noise (**a–d**), signals with added strong noise (**e–h**), and their corresponding spectra (**i–l**). The red lines represent the noise, and the blue lines represent the recorded signal. The gray vertical dashed line in the spectra figures indicates the fundamental frequency. To ensure comparability across scenarios, random sampling was performed once within the same Sstep, and the resulting datasets were used consistently for both the ML and TL models across all scenarios for that Sstep. This approach prevents unnecessary variability within scenarios and ensures fair performance comparisons between different noise conditions. For classification, a Support Vector Machine (SVM) algorithm was selected for both the ML and TL models due to its strong performance in traditional ML and TL applications [26]. The SVM classifier relies on several key hyperparameters: the kernel function, the regularization parameter C, and the kernel coefficient gamma. The kernel determines how input data are mapped into a higher-dimensional space for non-linear classification; options evaluated during a grid search included linear, polynomial, and radial basis function (RBF) kernels. The regularization parameter C, tested with values [0.1, 1, 10], controls the trade-off between margin maximization and training error minimization. The kernel coefficient gamma, which influences the reach of individual training samples, was tested using \"scale\" and \"auto\" settings. Higher values of C and gamma tend to create more complex decision boundaries, which may increase training accuracy at the cost of generalization. All three parameters were optimized using grid search with 5-fold cross-validation on the development dataset (preprocessed Dataset D) for the source-to-source task with 100% data availability. The optimal configuration--RBF kernel with C = 10 and gamma set to \"auto\"--was selected based on the best average validation accuracy. This configuration achieved a balance between model complexity and generalization capability. To ensure consistent and fair comparisons between ML and TL models, these hyperparameters were kept fixed across all evaluated scenarios. Additionally, the number of dimensions for the FFT-based feature vectors was determined through empirical evaluation. Various dimensionalities were tested, and 30 components were selected as a trade-off between preserving informative variance and avoiding overfitting. This dimensionality was applied consistently across all experiments. In the traditional ML approach, Principal Component Analysis (PCA) was applied for feature transformation from the FFT-transformed data samples, retaining a 30-dimensional feature space.