Sensor Number Optimization Using Neural Network for Ankle Foot Orthosis Equipped with Magnetorheological Brake

Apassive controlled ankle foot orthosis (PICAFO) used a passive actuator such as Magnetorheological (MR) brake to control the ankle stiffness. The PICAFO used two kinds of sensors, such as Electromyography (EMG) signal and ankle position (two inputs) to determine the amount of stiffness (one output) to be generated by the MR brake. As the overall weight anddesign of an orthotic devicemust be optimized, the sensor numbers on PICAFOwanted to be reduced. To do that, a machine learning approach was implemented to simplify the previous stiffness function. In this paper, Non-linear Autoregressive Exogeneous (NARX) neural network were used to generate the simplified function. A total of 2060 data were used to build the network with detail such as 1309 training data, 281 validation data, 281 testing data 1, and 189 testing data 2. Three training algorithms were used such as Levenberg-Marquardt, Bayesian Regularization, and Scaled Conjugate Gradient. The result shows that the function can be simplified into one input (ankle position) – one output (stiffness). Optimized result was shown by the NARX neural network with 15 hidden layers and trained using Bayesian Regularization with delay 2. In this case, the testing data shows Rvalue of 0.992 and MSE of 19.16.


Introduction
Ankle Foot Orthosis (AFO) is an L-shaped brace that covered the foot and the calf, which is intended to support the walking gait. It is usually used by the patient who suffered from a weak ankle due to spasticity. The weak ankle caused the inability of the patient to lift the foot upwards (inability of dorsiflexion). In this case, the toe clearance is not possible to be done by the patient, which resulted in a high probability of stumbling during walking performance [1]. Here the AFO limits the patient's plantar flexion by having a rigid ankle joint; hence the toe clearance of the patient can be ensured [2].
AFO has been developed and improved not only for ensuring the toe clearance but also for optimizing the benefit to the user's gait. The improvement especially can be seen on the AFO joint where it has been changed from a rigid joint to a flexible joint, and then to an articulated joint [3]. Compare to the other joint; the articulated joint has the least limitation of plantarflexion because it can freely rotate in 360 degrees. More forward propulsion is expected when using the AFO with an articulated joint. However, the articulated joint itself cannot control the ankle position and motion by itself. Therefore, it is necessary to include additional components such as sensors and actuators in the development of AFO with the articulated joint. The controller is also required for processing the input from the sensors and output to the actuators. As a result, the AFO can fabricate the gait of able-bodied subjects for patient training purposes [4].
The sensors are used for the detection of the gait phases and measurement of the controller feedback parameter. As each phase may have different controller methods or references, the detection of the gait phases became vital as it determined the controller's accuracy. A single or combination of sensors can be used for gait detection. As shown in previous works, there were two phases of gait detection using electromyography (EMG) sensor [5][6][7], three phases of gait detection using a combination of accelerometer and rotary encoder [8,9], and four phases gait detection using foot switches [1]. Each gait phase number may have advantages and disadvantages compared to each other. However, they were compatible with their respective controller.
Previously, an AFO which controlled passively using a magnetorheological (MR) brake has been developed [5][6][7]. Inside the MR brake, there is MR fluid that can solidify according to the applied magnetic field with a response time less than 0.2 s [10]. The brake was installed at the ankle joint to produce controllable damping stiffness on the ankle differently in distinct gait phases. Electromyography (EMG) sensor was used to measure EMG for detecting the gait phases such as stance and swing phase. The rotary encoder was also used to obtain the ankle position for adjusting the damping stiffness in different ankle positions such as forward, stand, and backward. Therefore, the amount of the damping stiffness is determined based on two sensors, such as the EMG sensors and rotary encoder using a Fuzzy Controller (FC) as shown by the overview of the PICAFO in Figure 1.
As the overall weight and design of an orthotic device must be optimized, the sensor numbers on PICAFO wanted to be tuned from two to one. The ankle position is the chosen parameter to be kept instead of the EMG because of the difficulty of placing the EMG sensor accurately that it may require several trials to get the wanted EMG [11]. A previous study reported damping stiffness or the ankle torque calculation by using a function of ground reaction force (GRF) [12], but no such report on ankle torque function based on ankle position only. There is a horizontal and vertical component of the GRF, where the horizontal one is often omitted in case of static gait (i.e., balancing body) [13]. During the dynamic walking activity, the contribution of horizontal GRF to calculate the ankle torque cannot be neglected [14]. However, measuring the horizontal GRF requires a bulky multi-axis force sensor, which is not suitable for clinical application. Also, this research aims to decrease the available sensor numbers instead of increasing it.  Therefore, the damping stiffness function based on ankle position is investigated in this research before implementing it in the real application. Be noted that the damping stiffness in this research is not the subject's ankle torque of the subjects. Instead, the damping stiffness is determined through trial and error in the previous study to control walking gait based on ankle position and EMG using the PICAFO [5]. Figure 2 shows the relationship between damping stiffness, ankle position, and EMG in the form of a fuzzy surface. Linear regression is a common method to find an estimation function of unknown variables [15]. However, it may be challenging to derive the linear function of ankle position to damping stiffness based on the previous works due to the non-linearity of EMG, ankle position, and damping stiffness, as shown by the surface fuzzy in Figure 2. The machine learning method is used to predict the simplified function of the damp-ing stiffness estimation function, thus reducing the sensor numbers [16]. The technique which is used in this research is the nonlinear autoregressive with exogenous inputs (NARX) neural network, which suitable to deal with the nonlinear system such as walking gait [17]. The comparison was done for a different network with different training algorithms, delay, and hidden layers number to obtain the appropriate network configuration.

Methodology
The steps conducted to obtain the simplified function using machine learning methods are data collection, data distribution, data training, data validation, and data testing.

Data collection and distribution
The necessary data collection was obtained from the experiment of an able-bodied subject performed walking on a treadmill with constant speed by using the PICAFO with a fuzzy controller, which has been presented in the previous work [5]. The collected data are the EMG, ankle position, and the estimated damping stiffness by the fuzzy controller. Like the earlier work, the EMG is presented in the voltage unit, ankle position is shown in the degree unit, and the damping stiffness is given in percentage of the maximum torque following the fuzzy controller. Although it was possible to obtain all the possibilities that could happen based on the fuzzy controller itself, the data from the walking experiment was chosen instead. Therefore, the A total of 1871 data points were collected from 30 consecutive walking steps from the experiment (100%). The data was then distributed to build the network for simplified the damping stiffness estimation function based on the ankle position. The 1871 data point was randomized into the neural network software with a distribution of 1309 data for training the network (70%), 281 data for network validation (15%), and another 281 data for network testing 1 (15%). Simplified damping stiffness estimation function was obtained from the trained network. Then, another 189 data point from three consecutive walking steps, which were different data, were used to test the trained network one more time (network testing 2). Figure 3 illustrates the data collection and distribution.

Data training, validation, and testing
Data training, validation, and testing were conducted by using the Neural Network Time Series toolbox, which available in MATLAB software. Three types of networks are available such as nonlinear, nonlinear autoregressive (NAR), and nonlinear autoregressive with exogenous inputs (NARX) neural network. The nonlinear network predicts the output y(t) given delay d past values of the input x(t). The NAR predicts the output y(t) given delay d past values of the output y(t). The NARX, which is the combination of nonlinear and the NAR predicts the output y(t) given delay d past values of the input x(t) and output y(t) as shown in In this research, the NARX network was the chosen network because it considers the past information [18]. It also proofed to be successful in dealing with a nonlinear system such as TA EMG prediction for enabling dorsiflexion [17] and pre-fall detection system based on EMG [15]. Figure 4 shows the NARX neural network used in this research.
Once the network was chosen, it was modified and compared to obtain the optimum configuration. The network has two layers of hidden layer and output layer, respectively. Each layer has neurons (n), delay (d), weight (w), compensator (b), and activation function. In the toolbox, the output layer only has one n, w, b, and activation function. The input neuron, I 1 , and I 2 are the net sum of b and scalar product of the previous process with w, as shown in Meanwhile, O 1 and O 2 are the output of the hidden layers and output layers, respectively, which is obtained by inserting I to the activation function. The hidden layers activation function is a symmetric-sigmoid transfer function, and the output layer activation function is a linear transfer function as shown in The toolbox allowed modification on d and n of the hidden layers. Therefore, the hidden n was varied, such as 1, 5, 10, and 15, and d was varied, such as 1, 2, 3. Network training algorithms, such as Levenberg-Marquardt (LM), Bayesian Regularization (BR), and Scaled Conjugate Gradient (SCG), are used to estimate w and b. LM algorithm updates w and b according to Jacobian jx of performance using the backpropagation algorithm [19]. BR algorithm is another variant of LM, which minimizes a linear combination of squared errors and weights, so it produces a good generalization of the nonlinear problem [20]. Meanwhile, the SCG algorithm used a backpropagation algorithm to calculates performance derivatives concerning the w and b [21]. Mean square error (MSE) and R-squared methods are used to justify the comparison between the trained network. In the end, damping stiffness prediction is conducted using the network, which has been trained in the best configuration.

Result
The comparison of network testing 2 with the different trained network are explained in this chapter. Figure 5 shows the MSE result of different hidden layer numbers, delay, and training algorithm of output response of the trained network. The lower MSE means the predictions approaches the target better. Figure 6 shows the R-squared result of different hidden layer numbers, delay, and training algorithm of output response of the trained network. The closer the R-squared to 1, the more similar the prediction to the target. In the figures, blue theme colored bars are delay 1, orange theme colored bars are delay 2, and green theme colored bars are delay 3. Brown theme colored lines are the mean result of each training algorithm for all hidden layers and delays. From the MSE results, in general, the Bayesian Regularization has the lowest average performance, with MSE of 28.45 compared to the other training algorithm. For identical hidden layer numbers, the lowest MSE is observed when the delay is 2 in all training algorithms except the Scaled Conjugate Gradient. For equal delay, the more the hidden layer numbers, the lower the MSE except for the result of the Scaled Conjugate Gradient training algorithm. For instance, a network with 15 hidden layers has lower MSE compares to a network with ten hidden layers. In conclusion, the lowest MSE of 19.16 was observed from network testing 2 data, which was trained using the Bayesian regularization training algorithm with 15 hidden layers and delay 2. From the R-squared results, in general, the Bayesian Regularization has the highest average R-squared of 0.988 x(t-1) 0.68 −1.85 x(t-2) 3.65 y(t-1) 0.54 y(t-2) 0. 19 10 x(t-1) 3.68 −2.49 x(t-2) 2.29 y(t-1) −0.82 y(t-2) −3.60 11 x(t-1) 3.77 −2.19 x(t-2) 1.05 y(t-1) −1.88 y(t-2) 2.08 compared to the other training algorithm. For identical hidden layer numbers, the highest R-squared is observed when the delay is 2. For equal delay, the more the hidden layer numbers, the higher the R-squared. However, a different result is found in the outcome of the Scaled Conjugate Gradient training algorithm, such as in delay 3, where the R-squared is decreased, the higher the hidden layer numbers. From these results, the highest R-squared of 0.992 was observed from network testing 2 data, which was also trained using the Bayesian regularization training algorithm with 15 hidden layers and delay 2 like the MSE result. Therefore, this configuration was considered as the best NARX configuration for predicting the damping stiffness based on the ankle position in this research. Table 1 shows the estimated w and b of the trained networks.
To evaluate the prediction, first, the target points were defined, which were obtained from data of three consecutive walking steps, as shown in Figure 3. Then, the output response of the damping stiffness prediction based on the ankle position using the best NARX configuration is shown in Figure 7. As shown in Figure 7, most of the prediction outputs followed the target points. However, few off-target predictions could be observed mainly during phase II with an error range of −31.52 to 29. The error was the difference between targets and output. For example, in sample 21, the target was 77.89, and the response was 70.6, which resulted in an error of 7.29. As for phase I, the off-target predictions could be seen during the end of first phase I. At the end of the day, the prediction points were united to draw the output response, which is shown by the solid black line.

Discussion
The previous work has shown work on a PICAFO equipped with MR brake, in which the damping stiffness was controlled using the Fuzzy controller based on the EMG and ankle position. Both the parameters serve different purposes, such as EMG for classifying the gait phases while the ankle position for adjusting the damping stiffness. Both the signal shows a similar pattern for each phase. The EMG has been reported to have active value during phase I and inactive value during phase II. Meanwhile, the ankle position is generally increased in phase I and decreased during phase II. Because of the pattern similarity between these input parameters, it was possible to reduce the sensor amounts to just one, such as the ankle position only.
The damping stiffness estimation based on the ankle position only can be predicted using a NARX neural net- The prediction output has high similarity to the target points with an Rsquared of 0.992 and considerable error with an MSE score 19.16. The errors mostly happened during phase II and only a few during phase I, if not only a little error. The little error happens because the data during phase II sometimes had the same value as the one during phase I, as shown by the highlighted point in Figure 8. Not only that, but the gradient might also be the same such as both the highlighted point in Figure 8 has a positive slope. The NARX prediction may still be confused because of this kind of behavior. Therefore, this explains the error that mostly happened during phase II.
The effect of the off-target prediction is inappropriate damping stiffness for assisting the walking gait. The errors mostly occurred during phase II, where the foot was off the ground, as illustrated in Figure 1. Here, to avoid inappropriate damping stiffness, aside from further modification of the current NARX network, an assumption that the damping stiffness has maximum value during phase II to lock the foot can be made [1]. Therefore, the damping stiffness prediction during this phase II was not necessary. Another suggestion is to use the neural network for predicting the gait phases using the ankle position data only instead of predicting the damping stiffness [22]. That way, both the gait phase classification and damping stiffness adjustment can be done by only using ankle position data. The goal of decreasing the PICAFO sensors can be realized by then. Figure 9 shows the improved PICAFO control system. The new PICAFO system has been tested on the real situation with a similar scenario to the previous study [5], where able-bodied subject walking using PICAFO. It can be seen that the PICAFO generates medium to high damping stiffness during the stance phase and high to low damping stiffness during the swing phase. The PICAFO with a trained network prevents the foot drop by applying high stiffness at the initial swing phase. It also allows natural initial contact by generating low stiffness at the end of the swing phase, as shown in Figure 10. The result is similar to the previously reported study [5]. However, the result can be achieved with less number of sensors, which is the rotary encoder only.
Other published work on AFO focuses on controlling the mechanical properties, both in terms of amount and    [23]. Examples of mechanical properties are ankle position, assistive torque, ankle velocity, and damping stiffness. Appropriate control and timing of the mechanical properties will affect the overall benefits of using the AFO [3]. On the contrary, less attention is given on sensor amount optimization. Although the less sensor amount also means less complexity, thus more comfortable AFO for the user. If the controlled mechanical properties or the gait detection method are changed, then the sensors should also be changed because different require information. Table 2 Shows the comparison of this study to other similar work, which are passive AFOs with MR actuators. Most of the controlled output is damping stiffness [1,7,[24][25][26]. Ankle position control is only possible with additional DC motor, as reported by Chen et al. [27]. Meanwhile, ankle velocity output is another approach to generate damping stiffness according to ankle velocity reference [9]. Most of the output type is timing, where the actuator generates an amount of output according to particular timing. Meanwhile, the amount-type output means the control system calculates the output's amount according to the current situation. Thus, this type of output requires more information and sensor compare to timing-based output, as shown in Table 2.
Svensson et al. [24] demonstrated passive AFO with a rotary encoder as the sole sensors for controlling the timing-based damping stiffness. Meanwhile, this study is the improvement of PICAFO from a previous study. The amount and timing of the output were controlled based on ankle position and EMG shown in Figure 2. The current PI-CAFO system with the trained NARX network developed in this study controls the amount and timing of the damping stiffness based on ankle position data only. Therefore, only a single rotary encoder is necessary. However, the damping stiffness does not represent the real damping stiffness that the subject needs. The data is obtained from the PI-CAFO with a fuzzy controller in a walking experiment of an able-bodied subject performed a walking with constant speed. The fuzzy controller generated damping stiffness, which is the optimum damping stiffness obtained through the trial and error process of walking with PICAFO [5]. Future work should investigate the relation of the ankle position and the real ankle torque, which is calculated using GRF during walking activity by adopting the methods presented in this study. By doing so, the PICAFO can assist the walking gait more accurately but with information from a single rotary encoder only.

Conclusion
Previously, the damping stiffness of a Passive Controlled Ankle Foot Orthosis (PICAFO) for preventing foot drop had been successfully estimated based on EMG and ankle position. Then, in this research, sensor number optimization for PICAFO is conducted using neural network methods. Nonlinear Autoregressive Exogenous (NARX) neural network is developed for predicting the damping stiffness based on the ankle position only using data of the previous work. Several modifications are conducted to find the best NARX configuration by varying the training algorithm (Levenberg-Marquardt, Bayesian Regularization, and Scaled Conjugate Gradient), hidden layer numbers (1,5,10,15), and the delay (1, 2, and 3). The best configuration to estimate w and b is found to be the NARX neural network that is trained by the Bayesian Regularization training algorithm with 15 hidden layers and a delay of 2. The output response using the trained network in Figure 7 shows that the prediction outputs can follow the targets with MSE of 19.16 And R-squared of 0.992. Despite this work's limitations, the finding suggests that the sensor number of PICAFO can be optimized by using the neural network method to make the PICAFO control system becomes the one shown in Figure 9. Future work should use the real ankle torque data calculated by using GRF information to train the NARX network. By doing so, PICAFO can give accurate assistance but using data from rotary encoder only.