###### Abstract
By analyzing the muscle activity data, a movement classifier for the subject was constructed to guide the control of the leg prosthesis. Compared to the traditional sequential approach, the parallel approach has a faster computing speed and higher computing accuracy. To achieve a suitable assistance pattern, the cost function of the robot was constructed based on muscle activity. In [26], an optimization process was proposed to regulate the control parameters to minimize the cost function. Various assistance patterns are designed for each gait condition. By recording the change in leg muscle activities, the cost function of the robot for different assistance patterns was obtained in a timely manner. However, complex coupling uncertainties between the human body and prosthetic systems can affect the tracking performance and stability of the control system. Adaptive control strategies have been used to address the complex coupling uncertainties. The adaptive controllers estimate the uncertainties of the system and regulate the control parameters to achieve the desired tracking performance. The persistence of excitation (PE) condition should be satisfied to guarantee the convergence of the estimation process [27]. Moreover, a finite excitation condition was extended to replace the PE condition in the concurrent learning control. The concurrent adaptive control method displays the exponential convergence of the adaptive estimation process [28]. The concurrent adaptive control method stores historical input and output data. The sequence was populated to full rank until sufficient data were collected [29]. This finite excitation condition ensured a more practical method for the convergence of the estimation process without considering strict parameter conditions. Concurrent adaptive control has been proposed for different human prosthesis systems to achieve comfortable contact between the human body and the robot [30]. However, it is a great challenge to promote concurrent adaptive control of robotic leg prostheses. Owing to the existence of nonlinear muscle models and uncertain coupled motor dynamics, it is highly difficult to achieve the desired control performance using parameter updates [31]. The aim of this study was to regulate the parameters of the CPG model to find a suitable trajectory for a leg prosthesis using human-in-the-loop optimization. To realize the natural regulation of the leg joint trajectories on the lower-limb prosthesis, the neuromuscular-force-based impedance method was used for different walking conditions. To incorporate the tracking performance of the joints and the user's comfort caused by the contact force between the stump and leg prosthesis, a combined cost function was designed. Human-in-the-loop optimization was proposed to adaptively regulate the parameters to minimize the cost function. The main novel contributions of this study are to optimize the control parameters to minimize the overall system's cost function under different walking terrains. The cost function included combined joint tracking errors and changes in contact force. sEMG was used to assist the subject to reshape the track trajectory under various walking conditions. To incorporate both the tracking performance of the joints and user comfort resulting from the contact force, a combined cost function was designed. Human-in-the-loop optimization was proposed to adaptively regulate the control parameters to minimize the cost function. The main innovation of this study lies in combining the human-in-the-loop optimization with adaptive control. Experimental results demonstrate that the suitable control parameters for the leg prosthesis were found using the human-in-the-loop optimization method, achieving a balance between tracking performance and changes in contact force for different walking tasks. The major contributions of this study are outlined as follows: (1) An individualized approach for the trajectory of a leg prosthesis was developed. A Central Pattern Generator (CPG) was used to parameterize the leg joint trajectory.