# Control and Analysis of Layered Soil Structure to Ensure Railway Roadbed Stability
## 3 Results
This allows for prompt and accurate determination of soil characteristics, which facilitates the adoption of timely measures to strengthen and stabilize the railway bed. The presence of different layers in the soil is reflected in the graphs in the form of bends and sharp changes in the sequence of time series. These bends indicate changes in soil characteristics, such as moisture, density, and composition, which are important for assessing the condition and stability of the railway roadbed. To automate the process of detecting these bends and improve the accuracy of data analysis, it was decided to use machine learning methods, particularly recurrent neural networks (RNNs) with long short-term memory (LSTM) [20; 21]. Recurrent neural networks (RNNs) can process sequential data, considering the dependence of the current state on the previous ones. This makes them ideal for analyzing time series, such as phase signal changes during ground probing. RNNs can be trained on data containing examples of time series with inflections, and can then automatically detect such changes in new data. The original data were a time series of phase changes of signals recorded during a laboratory experiment with a sampling frequency of 10,101 Hz. The total volume of the collected data was 500,000 samples, corresponding to approximately 454 s of observations. A low-pass filter with a cutoff frequency of 50 Hz was applied to remove high-frequency noise. Then, the data were normalized by bringing the values of phase changes to the range of [0, 1], which was necessary for the stable operation of the neural network. Sections of the time series corresponding to transitions between soil layers were identified. These sections were marked with the label \"1\" (bend), while the rest of the data were marked with the label \"0\" (no bend). As a result, 10,000 labels \"1\" and 490,000 labels \"0\" were obtained. To prevent model bias due to class imbalance, a technique of random under-sampling of class \"0\" to the size of class \"1\" was used. The data were divided into a training set (70%), a validation set (15%), and a test set (15%). The developed LSTM model had the following architecture (Figure 5): the input layer size corresponded to the time step length, which was set to 100; the first LSTM layer contained 64 neurons with the tanh activation function; the second LSTM layer contained 32 neurons with the tanh activation function; the fully connected layer contained 1 neuron with the sigmoid activation function to predict the probability of a bend. The model was trained using the Adam optimizer, and the loss function was binary cross-entropy. Training was carried out over 20 epochs with a batch size of 64. During model training, the loss function and accuracy metric were monitored on the training and validation samples. After completing the training, the model was tested on the test sample: Accuracy = 0.79; Recall = 0.81; Precision = 0.84; F1-score = 0.83. This indicates that the model copes well with the task, correctly classifying most of the data. The model effectively identifies most of the real bends, which is critical for preventing errors in monitoring and maintaining the reliability of the railway roadbed.