# Cycling Segments Multimodal Analysis and Classification Using Neural Networks
## Methods
### Data Processing  
The main items of the multichannel GPS and heart rate cycling data analysis and classification are presented in Figure 4. Data acquisition and the following processing steps included:  
* transformation of the data recorded in GPX format into the CSV format and their export to the appropriate (MATLAB) computational and visualization environment;
* interconnection of all data segments and exclusion of all stops longer than a selected threshold;
* rejection of gross errors, de-noising of all recorded signals, and their resampling with uniform sampling period, allowing data fusion for the following mathematical processing;
* interconnection of recorded GPS data with the Google map region;
* data segmentation using windows of the selected length. The data analysis included the following steps:  
* selection of windows fulfilling chosen criteria (altitude gradient within given limits for uphill, downhill, or flat cycling);
* detection of relations between individual signals;
* classification of selected segment features and evaluation of the accuracy of the classification, together with cross-validation of the model;
* evaluation of the results from a biomedical point of view. The preprocessing stage included the interconnection of all records of the cycling segments, the removal of gross observational errors, and the removal of cycling breaks. The following signal de-noising by a low-pass finite impulse response (FIR) filter was then used for the rejection of the undesirable components of each signal \(\{x(m)\}_{m=1}^{M}\) using  
\[y(n)=\sum_{k=0}^{R-1}\ b(k)\ x(n-k) \tag{1}\]  
Figure 4: The diagram of multimodal cycling data processing and signal segments classification presenting outputs of the first and the second elements of the neural network (NN) output for classification into \(S2=2\) classes. for the selected filter order \(R=30\) and the cutoff frequency estimated from the spectral components of the individual signals. The next resampling was used to evaluate the multichannel signals of the selected constant sampling frequency \(f_{s}=0.5\) Hz using spline interpolation in this stage. The proposed method assumes the segmentation of the given signals into \(N\)-sample long segments, and their analysis. The relations between the corresponding data segments were estimated with the cross-covariance function  
\[C_{xy}(k){=}\frac{1}{N}\sum_{i=1}^{N}(x(i)-\bar{x})(y(i{-}k)-\bar{y}) \tag{2}\]  
where \(\bar{x}\) and \(\bar{y}\) stand for the means of the individual signals \(\{x(n)\}_{n=1}^{N}\) and \(\{y(n)\}_{n=1}^{N}\), respectively. The cross-correlation function of the sequences for the GPS and physiological data were then evaluated by  
\[R_{xy}(k){=}\frac{C_{xy}(k)}{\sqrt{C_{xx}(0)\ C_{yy}(0)}} \tag{3}\]  
The relation between the recorded data sequences was evaluated by estimating the correlation coefficient \(r_{xy}=R_{xy}(0)\). The delay between individual signals was estimated by the cross-correlation function and its maximum value shift. To define the relations between the corresponding segment features, the correlation coefficients were evaluated, and the 95% confidence bounds related to the regression lines were estimated. Selected segment features were classified by the neural network (NN) [29; 32], support vector machine (SVM) [33], and the \(k\)-nearest neighbour methods [34] with the evaluation of class boundaries and cross-validation by the leave-one-out method. Cycling segment features formed the corresponding column of the pattern matrix \(\mathbf{P}_{R,Q}\), as specified in Figure 4. For each cycling segment, three features forming a column vector were evaluated: the heart rate, speed, and the delay of the heart rate change after the change of the gradient altitude.