# Developing Machine Learning-Based Models for Railway Inspection
## 5 Experimental Results  
There is no label information within the original datasets. To conduct these experiments, another column was manually added to indicate whether or not there is a joint the interval; and if there is a joint, which side track it is on (left or right). Three classes are coded as 0--\"None-joint\", 1--\"Left-joint\", 2--\"Right-joint\". There are two datasets collected from two different locations. For the first dataset, approximately 110,000 data points were labeled with 25 joints on left and 29 joints on right. This data set was separated into two parts with the front part as the training set and the latter part as the testing dataset. 15 left joints and 17 right joints are in the training set; and 10 left joints and 9 right joints are in the testing dataset. For the second dataset, the data partition method is the same as for the first data set with 134 joints on the left and 142 joints on the right in the training set; and 50 joints on the left and 47 joints on the right in the testing set. Table 2 shows the basic statistical results of the training dataset and testing dataset samples for each rail joint. From the statistical results the data points for each joint varies with a minimum value of 11 points and a maximum value of 19 in the training dataset and 15 in the testing dataset. As mentioned in the data representation algorithm, each data object for deep nets will be resampled with identical value of 100 data points after applying \"SciPy-interpolate\" algorithm. The training data was manipulated into the required format. Since a joint affected zone is around 2 cm wide on the rail, the sliding window interval is set up as 4 cm expanding around 1 cm to each end. After the data manipulation the training dataset is a matrix of three dimensions \(100\times 2\times n\), where 100 is the number data points in each sample after applying interpolation algorithm; 2 indicates the bivariate time series; and \(n\) is the number of samples. Most samples are labeled with 0 (\"None-joint\" class). After several empirical tests, this class was randomly downsized to 200 for the first data set and 1000 for the second dataset. Therefore \(n=200+15+17=232\) for the first dataset and \(n=1000+50+47=1097\) for the second dataset. This data matrix is normalized before training the model. The class label vector \(y=[y_{1},y_{2},\ldots y_{n}]\) with each \(y_{i}\) taking a value from \([0,1,2]\) as the class label of sample \(x_{i}\). The test dataset was segmented with overlapping sliding windows. For the training data, the joint locations were assumed to be known such that each joint can be segmented into one sample inclusively. However, the testing data was assumed unseen from the real world. By using the same segmentation method of sliding windows, it is possible that a sequence of data points representing a joint may be divided into several adjacent intervals and generate duplicate data objects for an identical joint. Consequently, a joint can be difficult to identify correctly. To prevent this occurrence, overlapping sliding windows are used, i.e., a sliding window with an overlap of front half with the previous window and an overlap of latter half with the next window. In this way, a joint can be fully covered by a window. The same interval of 4 cm is used thus the overlapped windows with an overlap of 2 cm with the previous window and an overlap of 2 cm with the next window. Each window was taken as one test sample. The output is a vector of class labels corresponding to each sample. However, with the overlapping sliding windows, a joint can be segmented in multiple successive windows (samples). These samples might be labeled with a joint label 1 or 2 but not consistent. This indicates that there a joint in this area but not sure on which side. To deal with this inconsistency, the samples with labels of joint classes (1 or 2) were taken. If several samples are from several successive overlapped windows (can be decided by their start and end locations), these samples will be merged as one sample.