# Personalization of Robot Behavior Using Approach Based on Model Predictive Control
## 4 Evaluation
### Comparison of Machine-Learning Algorithms Used for Training User Models  
In this work, we compared several algorithms that can be applied to train a user model that will be used to predict user reaction, which allows the choice of the right action for the robot in a given situation in the MPC paradigm. We decided to test the following five algorithms (with parameters given in parentheses): Decision Tree (gini split criterion), Random Forest (gini split criterion, num_estimators = 500, max_features = 0.4), ada boost(num_estimators = 1000, lr = 0.4), Light Gradient Boosting Machine (LGBM) (subsample = 1.0, num_estimators = 500, lr = 0.4, num_leaves = 80), KNN (n = 5) and two baseline algorithms, Random and One Rule, which select the reaction by random or using the one rule model learned from training data. To clear training data by removing outliers, the following three algorithms were applied: Isolation forest (IF) outliers fraction set according to [17], local outlier factor (LOF) outliers fraction set according to [18], one-class SVM (OCS) with 0.01 outliers. The results of the user models testing performed on a test dataset, containing 25% of the cases of the whole dataset, are presented in Table 2. As we can see, the best results were achieved by LGBM and Random Forest algorithms. All outlier removing algorithms achieved similar results--see Tables 3-5. To evaluate each machine-learning algorithm used to train the model, 300 simulated experiments were performed for each algorithm. Each experiment has 12 rounds. For the best action, we calculated the value of the quality function and then summed it for each experiment. The results shown in Figure 5 represent the performance of the base models, which are used in the framework to predict user behavior, as shown in Figure 3 and Algorithm 1. The charts show the evaluation results in the form of box plots, where the median is marked in the center of each box, and the box extends from the first quartile to the third quartile of the data. The best-performing model (LGBM) is the same as during the learning phase; see Table 2 and Figure 5.  
Figure 4: Flow chart presenting simulation flow. \begin{table}
\begin{tabular}{c c c c} \hline  & **Precision** & **Recall** & **F1-Score** \\ \hline random & 0.43 & 0.33 & 0.36 \\ \hline one rule & 0.24 & 0.28 & 0.24 \\ \hline adaBoost & 0.65 & 0.61 & 0.63 \\ \hline
**LGBM** & **0.97** & **0.97** & **0.97** \\ \hline knn & 0.65 & 0.62 & 0.63 \\ \hline tree & 0.91 & 0.90 & 0.90 \\ \hline
**random forest** & **0.94** & **0.94** & **0.94** \\ \hline \end{tabular}
\end{table} 
Table 4: Quality of User models trained using selected machine-learning algorithms and tested on the test data with outliers removed using the LOF algorithm. The two rows with the best results are highlighted in bold font. \begin{table}
\begin{tabular}{c c c} \hline  & **Precision** & **Recall** & **F1-Score** \\ \hline random & 0.43 & 0.33 & 0.36 \\ \hline one rule & 0.24 & 0.28 & 0.24 \\ \hline adaBoost & 0.65 & 0.61 & 0.63 \\ \hline
**LGBM** & **0.97** & **0.97** & **0.97** \\ \hline knn & 0.65 & 0.62 & 0.63 \\ \hline tree & 0.91 & 0.90 & 0.91 \\ \hline
**random forest** & **0.95** & **0.94** & **0.94** \\ \hline \end{tabular}
\end{table} 
Table 2: Quality of User models trained using selected machine-learning algorithms and tested on the test data. The two rows with the best results are highlighted in bold font. \begin{table}
\begin{tabular}{c c c c} \hline  & **Precision** & **Recall** & **F1-Score** \\ \hline random & 0.43 & 0.33 & 0.36 \\ \hline one rule & 0.24 & 0.28 & 0.24 \\ \hline adaBoost & 0.65 & 0.61 & 0.63 \\ \hline
**LGBM** & **0.97** & **0.97** & **0.97** \\ \hline knn & 0.65 & 0.62 & 0.63 \\ \hline tree & 0.91 & 0.90 & 0.90 \\ \hline
**random forest** & **0.94** & **0.94** & **0.94** \\ \hline \end{tabular}
\end{table} 
Table 3: Quality of User models trained using selected machine-learning algorithms and tested on the test data with outliers removed using the OCS algorithm. The two rows with the best results are highlighted in bold font.