#### 2.1. Data Acquisition

Figure 1a presents the location of sensors for the acquisition of accelerometric, positioning, and heart rate data during cycling experiments with different loads. Both the mobile phone at different locations (for accelerometric data recording) and the Garmin system (for the simultaneous recording of GPS data and the heart rate) were used for data acquisition. Sample signals for uphill and downhill cycling are shown in

Figure 1b–d.

The GPS and motion data (time stamps, longitude, latitude, altitude, cycling distance, and the cycling speed) were simultaneously measured by a Garmin fitness watch (Fenix 5S, Garmin Ltd., Schaffhausen, Switzerland). The heart rate data were acquired by a Garmin chest strap connected to a Garmin watch by the wireless data transmission technology. All data sets were acquired during the cycling experiments realised by a healthy and trained adult volunteer. Records were subsequently stored to the Garmin Connect website, exported in the specific Training Center (TCX) format (used for data exchange between fitness devices), converted to the comma-separated values (CSV), and imported into the MATLAB software for further processing.

A summary of the cycling segments for specific locations of the mobile phone used for accelerometric data acquisition is presented in

Table 1.

The original mean sampling frequency was 142 Hz (changing in the range $\langle 15,300\rangle $ Hz with the standard deviation STD = 114) for accelerometric data and 0.48 Hz (changing in the range $\langle 0.2,1\rangle $ Hz, STD = 0.27) for heart rate data.

Table 2 presents the categories used for the classification. They were selected according to the profile of the terrain, its slope being evaluated by the Garmin GPS system. The individual categories include: (i)

$c\left(1\right)$-

HillUp; (ii)

$c\left(2\right)$-

HillDown; (iii)

$c\left(3\right)$-

SteepHillUp; and (iv)

$c\left(4\right)$-

SteepHillDown cycling.

A sample time segment of the modulus of the accelerometric data simultaneously recorded by the mobile phone at the selected location (the

RightLeg) is presented in

Figure 1d. All procedures involving human participants were in accordance with the ethical standards of the institutional research committee and with the 1964 Helsinki Declaration and its later amendments.

#### 2.2. Signal Processing

The proposed data processing method included data analysis at first. The total number of 1293 cycling segments was reduced to 1254 segments in the initial step, to exclude those with the standard deviation of the speed higher than a selected fraction of its mean value. This process excluded 3% of the cycling segments with gross errors and problems on the cycling route, as specified in

Table 1.

In the next step, the linear acceleration data without additional gravity components were processed. Their modulus

${A}_{q}\left(n\right)$ of the accelerometric data was evaluated from the components

$A{x}_{q}\left(n\right)$,

$A{y}_{q}\left(n\right)$, and

$A{z}_{q}\left(n\right)$ recorded in three directions:

for all values

$n=0,1,2,\cdots ,N-1$ in each segment

$q=1,2,\cdots ,Q\left(pos\right)$N values long, for all classes and at positions

$pos$ specified in

Table 1. The Garmin data were used to evaluate the mean heart rate, cycling speed, and the mean slope in each segment. Owing to the slightly changing time period during each observation, the initial preprocessing step included the linear interpolation into a vector of uniformly spaced instants with the same endpoints and number of samples.

The processing of multimodal records

${\left\{s\left(n\right)\right\}}_{n=0}^{N-1}$ of the accelerometric and heart rate signals was performed by similar numerical methods. In the initial stage, their de-noising was performed by finite impulse response (FIR) filtering of a selected order

M, resulting in a new sequence

${\left\{x\left(n\right)\right\}}_{n=0}^{N-1}$ using the relation

with coefficients

${\left\{b\left(k\right)\right\}}_{k=0}^{M-1}$ forming a filter of the selected type and cutoff frequencies. In the present study, the selected cutoff frequency

${f}_{c}=60$ Hz was used for the antialiasing low pass FIR filter of the order

$M=4$. It allowed signal resampling for this new sampling frequency.

The accelerometric data were processed to evaluate the signal spectrum, covering the full frequency range of $\langle 0,{f}_{s}/2=30\rangle $ Hz related to the sampling theorem. The mean normalized power components in 4 sub-bands were then evaluated to define the features of each segment $q=1,2,\cdots ,Q\left(pos\right)$ for each class and sensor position. The resulting feature vector $F(:,q)$ includes in each of its columns q relative mean power values in the frequency bands $\langle {f}_{c1},{f}_{c2}\rangle $ Hz, which form a complete filter bank covering the frequency ranges of $\langle 0,3\rangle $, $\langle 3,8\rangle $, $\langle 8,15\rangle $, and $\langle 15,30\rangle $ Hz. The next row of the feature vector includes the mean heart rate in each segment $q=1,2,\cdots ,Q\left(pos\right)$.

Each of the selected spectral features of a signal segment

${\left\{y\left(n\right)\right\}}_{n=0}^{N-1}$N samples long was evaluated using the discrete Fourier transform, in terms of the relative power

$PV$ in a specified frequency band

$\langle {f}_{c1},{f}_{c2}\rangle $ Hz, as follows:

where

$\mathsf{\Phi}$ is the set of indices for which the frequencies

${f}_{k}\phantom{\rule{-0.166667em}{0ex}}=\phantom{\rule{-0.166667em}{0ex}}\frac{k}{N}{f}_{s}\in \langle {f}_{c1},{f}_{c2}\rangle $ Hz.

Figure 1e,f presents selected features during different physical activities.

Figure 1e shows the distribution of the mean power in the frequency ranges

$\langle 0,3\rangle $ Hz and

$\langle 8,15\rangle $ Hz, and

Figure 1f presents the distribution of the mean power in the frequency range

$\langle 3,8\rangle $ Hz and the mean heart rate for different categories of cycling (route conditions) with cluster centers and ellipses showing multiples of the standard deviations.

The validity of a pair of features

$F1,F2$ selected from the feature vector

$F(:,q)$ for all segments

$q=1,2,\cdots ,Q\left(pos\right)$ related to specific classes

$c\left(k\right)$ and

$c\left(l\right)$ and positions

$pos$ was evaluated by the proposed criterion

${Z}_{pos}(k,l)$ for cluster couples

$k,l$ defined by the relation:

where

using the Euclidean distance

${D}_{pos}(k,l)$ between the cluster centers

${C}_{k}$,

${C}_{l}$ of the features associated with classes

k and

l, respectively, and the sum

$S{T}_{pos}(k,l)$ of their standard deviations. For well-separated and compact clusters, this criterion should take a value larger than zero.

Signal analysis resulted in the evaluation of the feature matrix

${\mathbf{P}}_{R,Q}$. The feature vector

${[p(1,q),p(2,q),\cdots ,p(R,q)]}^{\prime}$ in each of its columns includes both the mean power in specific frequency ranges and the mean heart rate. The target vector

${\mathbf{TV}}_{1,Q}={[t\left(1\right),t\left(2\right),\cdots ,t\left(Q\right)]}^{\prime}$ includes the associated terrain specification according to

Table 2 with selected results in

Figure 2. Different classification methods were then applied to evaluate these features.

#### 2.3. Pattern Recognition

Pattern values in the feature matrix

${\mathbf{P}}_{R,Q}$ and the associated target vector

${\mathbf{TV}}_{1,Q}$ were then used for classifying all

Q feature vectors into separate categories. System modelling was performed by a support vector machine (SVM), a Bayesian method, the

k-nearest neighbour method, and a neural network [

22,

55,

56,

57]. network Both the accuracies and the cross-validation errors were then compared with the best results obtained by the two-layer neural network.

The machine learning [

57,

58] was based on the optimization of the classification system with

R = 5 input values (that corresponded with the features evaluated as the mean power in four frequency bands and the mean heart rate) and

$S2$ output units in the learning stage. The target vector

${\mathbf{TV}}_{1,Q}$ was transformed to the target matrix

${\mathbf{T}}_{S2,Q}$ with units in the corresponding class rows in the range

$\langle 1,S2\rangle $ to enable evaluating the probability of each class.

In the case of the neural network classification model, the pattern matrix

${\mathbf{P}}_{R,Q}$ formed the input of the two-layer neural network structure with sigmoidal and softmax transfer functions presented in

Figure 3a and used to evaluate the values by the following relations:

For each column vector in the pattern matrix, the corresponding target vector has one unit element in the row pointing to the correct target value.

The network coefficients include the elements of the matrices

${\mathbf{W}\mathbf{1}}_{S1,R}$ and

${\mathbf{W}\mathbf{2}}_{S2,S1}$ and associated vectors

${\mathbf{b}\mathbf{1}}_{S1,1}$ and

${\mathbf{b}\mathbf{2}}_{S2,1}$. The proposed model uses the sigmoidal transfer function

$f1$ in the first layer and the probabilistic softmax transfer function

$f2$ in the second layer. The values of the output layer, based on the Bayes theorem [

22], using the function

provide the probabilities of each class.

Figure 3b illustrates the pattern matrix formed by

Q column vectors of

R = 5 values representing the mean power in 4 frequency bands and the mean heart rate.

Figure 3c presents the associated target matrix for a selected position of the accelerometric sensor.

Each column vector of grey shade pattern values was associated with one of the $S2$ different target values during the learning process.

The receiver operating characteristic (ROC) curves were used as an efficient tool for the evaluation of classification results. The selected classifier finds in the negative/positive set the number of true-negative (TN), false-positive (FP), true-positive (TP), and false-negative (FP) experiments.

The associated performance metrics [

59] can then be used to evaluate:

Sensitivity (the true positive rate, the recall) and specificity (the true negative rate):

Precision (the positive predictive value) and

$F1$-score (the harmonic mean of the precision and sensitivity):

Cross-validation errors [

60] were then evaluated as a measure of the generalization abilities of classification models using the leave-one-out method.