## 2 Methods and System Setup
### Activity Recognition Method
The radial basis function (RBF) has been widely applied in approximation and classification tasks because of its structural simplicity; its learning process converges quickly, and no local minimum problem occurs. Therefore, we proposed a fusion algorithm (SVM- RBF-KNN) based on extending SVM, KNN, and RBF to recognize and classify complex rehabilitation activities. We set up seven cluster centers based on evaluation criteria for abnormal and normal gaits and falls provided by a rehabilitative therapist, and combine these with real data. Let \(x_{1},x_{2},...\)\(x_{n}\in R^{d}\) be the n training samples; \(C_{i}\) is the ith cluster center; and the representation \(y_{i}\) of the hidden layer, which maps the input \(x_{k}\) into \(y_{i}\), is calculated using the following nonlinear function:  
\[y_{i}=\Phi(X_{k},X_{i})=\omega G(X_{k},X_{i})=\omega G(X-X_{i})=\omega e^{(- \frac{1}{2\sigma^{2}}X_{k}-X_{i})} \tag{10}\]  
\[\sigma=\frac{d_{max}}{\sqrt{2n}} \tag{11}\]  
where \(\sigma\) is a parameter scaling the Euclidean distance between \(\Phi(X_{k})\) and \(\Phi(X_{i})\), and \(d_{\max}\) is the maximum distance between the selected centers, \(X_{i}\in C_{i}\), where \(C_{i}\) denotes the neighborhood of \(x_{i}\) in the feature space \(\mathcal{F}\). To obtain reliable clustering centers, we adopted a supervised learning algorithm. The RBF function center \(C_{i}\), expansion constant \(\sigma_{j}\), and output weight \(\omega_{j}\) should be trained  
Figure 5: The two-stage activity recognition classifier. by a supervised learning algorithm and undergo a process of error-corrected learning to obtain their optimal values. The gradient descent method is used to define the objective function as follows:  
\[e_{k}=d_{k}-\sum\limits_{i=1}^{I}\omega_{i}J\Big{(}\|X_{k}-t_{i}\|_{C_{j}}\Big{)} \tag{12}\]  
\[E=\frac{1}{2}\sum\limits_{i=1}^{n}{e_{k}}^{2} \tag{13}\]  
\[\Delta t_{j}=-\eta\frac{\partial E}{\partial t_{j}} \tag{14}\]  
\[\Delta\omega_{j}=-\eta\frac{\partial E}{\partial\omega_{j}} \tag{15}\]  
\[\sum_{l=1}^{NK}e^{[(x^{T}\omega_{k}-1)/\sigma^{2}]} \tag{8}\]0  
The algorithm iterates until the cluster centers are obtained. The weight \(\omega\) can be obtained as follows:  
\[\sum_{l=1}^{NK}e^{[(x^{T}\omega_{k}-1)/\sigma^{2}]} \tag{8}\]1  
\[\sum_{l=1}^{NK}e^{[(x^{T}\omega_{k}-1)/\sigma^{2}]} \tag{8}\]2  
The SVM-RBF-KNN Algorithm 1 for acquiring the cluster centers is shown below:  
```
<Sample ID#>  Input samples: {photoelectric sensors signal: \(P_{1}\), \(P_{2}\), \(P_{4}\), \(P_{6}\), {tension sensors signal: \(T_{sem}\), \(d\) (\(T_{1}\), \(T_{4}\)), \(d\) (\(T_{2}\), \(T_{3}\)), \(d\) (\(T_{1}\), \(T_{3}\)), \(d\) (\(T_{4}\), \(T_{2}\)), {IMU sensors signal: \(A_{sem}\)}. Transform IMU sensor signal to SVM value: \(A_{sem}(SignalMagmittedVector)=\sqrt{\left(A_{x}\right)^{2}+\left(A_{y}\right)^{2 }+\left(A_{z}\right)^{2}}\) Initialization; Randomly select eight cluster centers [\(X_{1},\ X_{2},\ldots,X_{i}\)]; for i = 1: maximum iterations if E<=0.00001 break; for i = 1 to N do, Forward propagation: compute output and the error: \(\alpha_{k}=d_{k}-y_{i}\); compute sum error: \(E=\sum\limits_{i=1}^{N}{\alpha_{i}}^{2}\); Backward propagation: update parameters: \(\Delta t_{j}=-\eta\frac{\partial E}{\partial t_{j}}\) \(\Delta\omega_{j}=-\eta\frac{\partial E}{\partial\omega_{j}}\) \(\Delta\sigma_{j}=-\eta\frac{\partial E}{\partial\omega_{j}}\) Iterate until cluster centers [\(C_{1}\), \(C_{2},\ldots,C_{i}\)] are obtained. end for  Generate clustering centers and weights. end for
```  
**Algorithm 1**SVM-RBF-KNN algorithm