# In-Motion, Non-Contact Detection of Ties and Ballasts on Railroad Tracks
## 5 Analysis
### Application of Machine Learning to LiDAR Data
#### 5.3.2 The Difference between Left and Right LiDAR Sensor Measurements  
The difference between the left and right LiDAR sensor measurements could be used as input to train the model. This approach is expected to enhance the signal-to-noise ratio, as ballasts typically exhibit more significant surface irregularities in lateral, longitudinal, and vertical directions. While significant differences in surface figures between a tie's left and right sides (i.e., where the sensors are pointed) are not expected, the ballast sections' left and right sides can vary considerably. Hence, by comparing--or differencing--the left and right LiDAR measurements, more regularities in the tie sections and irregularities in ballast sections can be enforced in the data, facilitating a more accurate distinction between the two. Figure 15 shows a sample section of the difference between the left and right LiDAR sensor measurements. Comparing Figure 15 with Figure 12, it is evident that the surface figure variation between ties (orange-shaded) and ballasts (unshaded) is now much more pronounced here. Figure 16 shows the performance of ML models using Decision Tree/Logistic Regression over different window sizes when trained on the difference between the left and right LiDAR sensor measurements. Figure 16 proves that ML models perform better when trained on the difference between the left and right LiDAR sensor measurements than before by showing a slight increase in accuracy based on the Decision Tree algorithm across all window sizes. The improvement is attributed to the improved classification of abnormal ties as ties. However, Logistic Regression could not learn the pattern from these data, since it employs a simple linear classifier; hence, its results are not shown. As expected, using  
Figure 14: A sample section illustrating the model’s performance in differentiating ties and ballasts. The blue line represents the model’s predictions, where 1 indicates a tie and 0 indicates ballast. The model is trained on the left LiDAR’s distance measurements (distance from the LiDAR sensor to the tie/ballast surface) using the Decision Tree algorithm with a window size of 40. Both ties (highlighted in orange) are cracked. the difference between the left and right measurements as input to the models could result in a more accurate and reliable model. A similar trend to that observed in Figure 13 can be seen in Figure 16, where accuracy increases with larger window sizes and reaches a plateau at higher values. 3.3 Machine Learning on the Standard Deviation of the Difference between the Left and Right Sensor Measurements  
Although the previous method demonstrated good performance, there is potential to achieve even higher accuracy. Another approach could be combining standard deviation with machine learning to combine the strengths of both methods. Machine learning excels in classification tasks by learning patterns from different classes to distinguish them. Meanwhile, the standard deviation method reveals more precise and more distinct patterns in a dataset. Integrating these two approaches may achieve better classification performance. The idea is to apply the \"moving standard deviation\" mentioned earlier to the difference between the left and right sensor measurements. Figure 17 shows the standard deviation of the difference between the left and right sensor measurements from the previous subsection. The data have clear and distinct patterns over ties (orange-shaded) and ballasts (unshaded). Figure 18 shows the performance of ML models using Decision Tree/Logistic Regression over different window sizes when trained on the standard deviation of the difference between the left and right sensor measurements. Figure 18 reveals that the Decision Tree algorithm achieves accuracies comparable to those obtained using the difference between the left and right sensors. Additionally, it performs more consistently across various window sizes, demonstrating robust performance at different speeds.