## 2 Materials and Methods
### Clustering for Identification of Muscle Activation Patterns  
Temporal muscle activation analysis is of great interest for monitoring and assessing altered locomotion patterns in neurorehabilitation. Specific algorithms are required to characterize muscle activation patterns during cyclical movements, such as locomotion, because of the muscle activation pattern variability. The Clustering for Identification of Muscle Activation Patterns (CIMAP) is an algorithm based on agglomerative hierarchical clustering that characterizes muscle activation intervals during cyclic movements by grouping cycles with similar muscle activities [30; 31]. The CIMAP algorithm has been applied in \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Number of Sessions** & **Days** & **GF [\%]** & **Measurement** & **Total Number of Gait Cycles** \\ \hline Pre & 0 & - & Clinical assessment & \\
1 st & 1 & 100 & EMG & 106 \\
2 nd & 2 & 95 & EMG & 367 \\
3 rd & 8 & 95 & & \\
4 th & 9 & 95 & & \\
5 th & 16 & 95 & & \\
6 th & 22 & 95 & & \\
7 th & 23 & 90 & EMG & 570 \\
8 th & 29 & 90 & & \\
9 th & 30 & 90 & & \\
10 th & 36 & 90 & & \\
11 th & 37 & 85 & EMG & 573 \\
12 th & 44 & 85 & & \\
13 th & 46 & 80 & EMG & 439 \\
14 th & 50 & 80 & & \\
15 th & 53 & 80 & & \\
16 th & 57 & 80 & & \\
17 th & 58 & 75 & EMG & 493 \\
18 th & 64 & 75 & & \\
19 th & 65 & 70 & EMG & 517 \\
20 th & 72 & 70 & & \\ Post & 73 & - & EMG, Clinical assessment & 143 \\ Follow-up & 99 & - & EMG & 102 \\ \hline \hline \end{tabular}  
* The table shows the number of sessions, date of session, and guidance force (GF) at that time. Clinical assessment refers to measurements of the 10-m walk test (10 MVT), 6-min walk test (6 MVT), manual muscle test (MMT) and force, pediatric balance scale (PBS), and gross motor function measure (GMFM-66). EMG refers to electromyography in 10 muscles during the gait. All sessions were performed at a body weight support of 80% and a walking speed of 0.5 km/h. The number of steps counted using the accelerometer is also shown in the table.  
\end{table} 
Table 1: Overview of the experimental conditions. muscle activity pattern assessment during walking in both physiological and pathological conditions, and in gait asymmetry evaluation in healthy individuals or patients with neurological diseases [32; 33; 34; 35; 36]. The CIMAP algorithm was also used to determine muscle activation pattern changes in the patient. In particular, considering a specific muscle, the algorithm consists of two phases: (a) dataset preparation and (b) clustering of each dataset. First of all, each gait cycle extracted from the signal processing stage is binarily transformed by the instant of the muscle activation (i.e., ON _or_ OFF) using a specific threshold:  
\[\textit{gail}_{i}=\{\text{(ON {or OFF)}}\;_{i,1},\text{(ON {or OFF)}}\;_{i,2},\cdots,\text{(ON {or OFF)}}\;_{i,m-1},\text{(ON {or OFF)}}\;_{i,m}\;\} \tag{1}\]  
where \(i\) denotes the number of gait cycles and \(m\) denotes the size of the time-normalized cycle. Dendrogram clustering is then applied to every dataset. At the beginning, each cycle is considered as a single-element cluster. Every cluster (i.e., \(A\)) is represented by its centroid (i.e., \(\mathit{CLC}_{A}\)):  
\[\mathit{CLC}_{A}=\frac{1}{|A|}\sum_{gail_{i}\in A}gail_{i}\]  
where \(\mathit{CLC}_{A}\) denotes the centroid of every cluster A, \(i\) denotes the number of gait cycles, and \(|A|\) denotes the cardinality of the cluster \(A\). The two closest clusters calculated by the L-infinity norm are then merged. The dendrogram is cut when the merged clusters have small intra-cluster variability but a large distance of one with respect to the others.