## 2 Methods
### Signal Processing and Classification Schemes  
Accelerographic and gyroscopic information of anatomical body segments including feet, trunk-pelvis, and forearms were calculated in three-dimensional trajectories and expressed in local segment coordinate systems using Visual3D (C-Motion, Inc., Germantown, MD, USA). The tasks included ramp ascent (RA), ramp descent (RD), stair ascent (SA), stair descent (SD), and level-ground walking (LW). In the training data set, changes of direction on the elevated platform, level-walking data that followed stair/ramp, and level walking  
Figure 1: (**A**) “Terrain park” circuit setup was comprised of a four-step staircase, a ramp and elevated platforms. Subjects performed trials of the circuit in the following orders: They started at point A, performed the locomotion as shown, and stopped at point B. They executed the tasks in the reverse order in the next trial, starting at point B and ending at point A. Circuit trials were performed for both the left leading and right leading legs. (**B**) Sixty-six reflective markers were attached to anatomical body locations to track 12 body segments of the arms, legs, and torso. preceding stair/ramp (Figure 1A) were all marked as LW. However, level-ground walking data that preceded and followed stair/ramp were tested separately and labeled as LWp and LWf respectively. The beginning of each locomotor mode was marked as the last toe-off of the transitioning leg on the previous terrain. Data were exported to MATLAB (MathWorks, Natick, MA, USA) for further analysis. In order to classify the locomotor activities of individuals with PD, the following classification algorithms, training paradigms, and signal sources were studied. _Classification Algorithms_  
* Linear discriminant analysis (LDA)
* Long-short-term memory (LSTM) recurrent neural network. LSTM network parameters were set as follows: batch size = 50, number of epochs = 70, number of layers = 100  
_Training Paradigms_  
* Subject independent I: The classifiers were trained on able-bodied data and evaluated on PD patient's data. * Subject independent II: The classifiers were trained on PD patients' data, leave-one-subject-out was performed across the patients for model evaluation. * Subject dependent: Training and testing were performed within trials of each PD patient's data using cross-validation. _Signal Sources_  
* Feet
* Trunk-pelvis
* Signal fusion (combination of feet, trunk-pelvis, and forearms data)  
Signals were divided into sliding and overlapping analysis windows of size 500 ms with 250 ms increment [21]. The classifiers associated each window to one of the locomotor tasks. To classify the tasks using LDA, six time-domain features including minimum, maximum, mean, standard deviation, first and last sample of each window were extracted [22]. The six features were computed per window. These features are computationally inexpensive and have functioned relatively well in intent recognition frameworks [23; 24]. LSTM was applied on raw data without employing feature extraction. The number of neurons in the input layer was adjusted according to the number of input signals. For instance, for feet, forearms, and trunk-pelvis data, input layer was comprised of 12 neurons as we utilized bilateral accelerographic and gyroscopic signals in three dimensional trajectories. For the combination of all signals (signal fusion) input layer had 36 neurons. Parameters optimized for LSTM include batch size, number of epochs, and number of hidden units. The optimal value for the parameters were selected not just based on the best outcome but also considering the computation time needed to reach that outcome. For instance, while 200 epochs often provided better outcomes relative to 70, the improvement was negligible. Thus, 70 was selected as the optimal number of epochs. Using similar approach, batch size and the number of hidden units were selected as 50 and 100 respectively. A cross-entropy cost function was used to compare the predicted value with the real value during each epoch.