## 3 Methods
### Machine Learning Analysis  
Three types of models were designed to predict the dynamic stiffness. The key difference lies in the inputs used. The first model considers the inputs' static stiffness, frequency, toe load, and load amplitude. The second model includes the kind of rail pad as an additional input. The last model includes, additionally, information regarding the variables corresponding to the test conditions mentioned in Table 1. For each model type, various ML algorithms were evaluated to determine their predictive performance. The selection of algorithms in machine learning depends significantly on the characteristics of the dataset, as different types of tasks (classification, regression, and clustering) and dataset properties (size, balance, and type of variables) can favor the performance of certain algorithms over others, as can be seen in other studies [14; 16; 17; 18; 21]. Some of the most widely used models are as follows:  
* Multiple Linear Regression (LR): predicts a dependent variable using two or more independent variables under the assumption of a linear relationship between them;
* Lasso (L1 Regression): A linear regression model that introduces an L1 penalty in the cost function. This penalty forces some coefficients to become exactly zero, effectively performing feature selection and helping to reduce overfitting;
* Ridge (L2 Regression): A linear regression model that adds an L2 penalty to the cost function. This penalty shrinks the magnitude of coefficients, reducing variance and mitigating multicollinearity without setting any coefficients to zero. Unlike Lasso, it does not eliminate features entirely;
* k-Nearest Neighbors (KNN): classifies a sample by assigning it the most common label or value among its k-nearest neighbors within the feature space;
* Decision Tree (DT): a tree-based structure where each node represents a feature, each branch represents a decision, and each leaf represents an outcome;  
Figure 4: Graphs showing the force-displacement curves from static (**a**) and dynamic (**b**) stiffness tests.  
Random Forest (RF): a technique that combines multiple decision trees to enhance prediction accuracy by reducing overfitting and increasing robustness;
* Gradient Boosting (GB): a sequential method that builds predictive models, where each iteration focuses on correcting the errors of the previous model to improve prediction accuracy.  
Validation involves dividing the dataset into training and testing subsets to accurately assess the model's predictive performance. The selected machine learning algorithms were chosen due to their capability to adapt effectively to the specific characteristics of the dataset, thereby optimizing the results. The quality of each predictive model is evaluated by comparing its predicted outputs against the actual values, using performance metrics such as the following:  
* Root Mean Squared Error (RMSE): A metric that measures the average difference between the values predicted by a model and the actual values. It is calculated by taking the square root of the average of the squared errors;
* Mean Absolute Error (MAE): a metric that measures the average of the absolute differences between predictions and actual values;
* Coefficient of Determination (R\({}^{2}\)): measures how well a model explains the variability of the data.  
Once the highest-performing algorithms were selected, we fine-tuned their hyperparameters through a grid search implemented with GridSearchCV (part of the scikit-learn package). Grid search builds a cartesian product of user-defined candidate values, for example, number of trees {100, 300, 500} and maximum depth {None, 10, 20}, in a random forest and evaluates every combination via cross-validation. This procedure allows for finding the best combination of hyperparameters from a predefined set.