# An AI-Based Exercise Prescription Recommendation System
## 2 Methods
### Modules Construction
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Raw Data** & **One-Hot Encoding** & **Transferred Data** \\ \hline Gender & 0 & [1,0] \\  & 1 & [0,1] \\ \hline \multirow{4}{*}{Height} & Height \(<\) 150 & [1,0,0,0,0] \\  & 150 \(\leq\) Height \(<\) 160 & [0,1,0,0,0] \\  & 160 \(\leq\) Height \(<\) 170 & [0,0,1,0,0] \\  & 170 \(\leq\) Height \(<\) 180 & [0,0,0,1,0] \\  & 180 \(\leq\) Height & [0,0,0,0,1] \\ \hline \multirow{4}{*}{Weight} & Weight \(<\) 50 & [1,0,0,0,0] \\  & 50 \(\leq\) Weight \(<\) 70 & [0,1,0,0,0] \\  & 70 \(\leq\) Weight \(<\) 90 & [0,0,1,0,0] \\  & 90 \(\leq\) Weight \(<\) 110 & [0,0,0,1,0] \\  & 110 \(\leq\) Weight & [0,0,0,0,1] \\ \hline \multirow{4}{*}{Age} & Age \(<\) 17 & [1,0,0,0,0,0] \\  & 17 \(\leq\) Age \(<\) 25 & [0,1,0,0,0,0] \\  & 25 \(\leq\) Age \(<\) 35 & [0,0,1,0,0,0] \\  & 35 \(\leq\) Age \(<\) 45 & [0,0,0,1,0,0] \\  & 45 \(\leq\) Age \(<\) 55 & [0,0,0,0,1,0,0] \\  & 55 \(\leq\) Age \(<\) 65 & [0,0,0,0,1,0] \\  & 65 \(\leq\) Age & [0,0,0,0,0,1] \\ \hline \multirow{4}{*}{Rest HR} & Rest HR \(<\) 50 & [1,0,0,0,0] \\  & 50 \(\leq\) Rest HR \(<\) 60 & [0,1,0,0,0] \\ \cline{1-1}  & 60 \(\leq\) Rest HR \(<\) 70 & [0,0,1,0,0] \\ \cline{1-1}  & 70 \(\leq\) Rest HR \(<\) 80 & [0,0,0,1,0] \\ \cline{1-1}  & 80 \(\leq\) Rest HR & [0,0,0,0,1] \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Different range to transfer raw value of input data into one-hot vector. data, the rest of data is annotated as training data. The total amount of training data of 3m-SEM is equal to 249. Due to the unbalance problem between each group's data amount, Synthetic Minority Oversampling Technique (SMOTE) algorithm [25] is applied to overcome the problem. After balancing the amount of training data between each group, we picked 6000 pieces of data inside the training data repeatedly to augment the amount of training data. 10-fold cross validation is applied for 3m-SEM's hyper-parameters tuning. Next, we retrained 3m-SEM using fixed hyper-parameters for fine tuning. Testing data is used to test performance of fine-tune 3m-SEM. A four-layer neural network is applied for 3m-SEM training. The number of nodes in first layer equals to 24 which is corresponding to the dimension of input data. The number of nodes is set to 20 and 10 in the second and the third layer. The last layer is consisted of 4 nodes which is reasoned by the number of classes to predict. The overview of SEM modules' training and testing procedure are shown in Figure 2A. The 1m-SEM, 2m-SEM and 3m-SEM's testing accuracy are shown in the result section. The training and testing procedure of 1m-PV, 2m-PV and 3m-PV are the same. Taking 3m-PV for example, we randomly picked 90% of total data as the module's training data. The rest of 10% of total data is used to test module's final prediction accuracy. We picked 6000 pieces of data inside 90% of total data repeatedly in order to augment the amount of training data. 10-fold cross validation is applied for 3m-PV's hyper-parameters tuning. Figure 2: **(A)** The overview of SEM modules’ training and testing procedure; **(B)** The overview of PV modules’ training and testing procedure. SEM: suggested exercise mode. PV: predicted value of rest HR difference after following suggested exercise mode. After that, we retrained 3m-PV using the fixed hyper-parameters for fine tuning. Testing data is used to test performance of fine-tune 3m-PV. A four-layer neural network is applied to construct 3m-PV. From the first layer to the third layer of 3m-PV, it adopted the same structure as 3m-SEM. The amount of node in the last layer equals to 1 which is reasoned by the single scalar of rest HR difference value we are going to predict. The number of epoch and batch size is fixed to 500 and 16 after hyper-parameters tuning in both SEM and PV modules. Early-stopping function is applied during both 10-fold cross validation and fine tuning. The overview of PV modules' training and testing procedure are shown in Figure 2B. The testing accuracy of 1m-PV, 2m-PV and 3m-PV are shown in the Results section.