# A Methodology for the Mechanical Design of Pneumatic Joints Using Artificial Neural Networks
## 3 Dataset Construction and Regression Algorithms
### Regression Algorithms  
After creating the Bend dataset, the trials were divided 80% into training and 20% into validation [52]. Next, with the Regression Learner toolbox in MATLAB R2023b, inputs and outputs were normalized in the range 0-1 and set to analyze the performance of 14 regression algorithms. The results of root mean square error (RMSE) for the training and  
Figure 4: Example of test number 6, at P = 1.2 bar, L = 10 mm, R = 0.5, \(\Theta\) = 40\({}^{\circ}\): (**a**) raw image; (**b**) image after _undistorted_ filter application; (**c**) image after _imlocalbright_ filter application and detail about open sector bending angle \(\alpha\). Histogram of pixel intensities for: (**d**) raw image; (**e**) undistorted image; (**f**) image with contrast improved. validation phases, training time, and model size are shown in Table 3. RMSE is defined as the standard deviation of the residuals, according to Equation (3):  
\[RMSE=\sqrt{\sum_{i=1}^{n}\frac{\left(\alpha_{exp}-\alpha_{pre}\right)^{2}}{n}} \tag{3}\]  
where \(\alpha_{\text{exp}}\) and \(\alpha_{\text{pre}}\) are the experimental and predicted responses, while \(n\) is the number of observations. The square elevation of the residuals prevents positive and negative values from canceling each other out. In addition, with this parameter, errors of greater value are amplified; therefore, they allow methods involving more significant errors to be discarded. Ideally, an RMSE value of 0 indicates a perfect fit between the measured response and that predicted by the algorithm. The algorithm with the lowest RMSE was the Bilayered neural network (BNN) (in bold in Table 3), which is composed of two layers with twenty-five neurons fully connected and a rectified linear unit (ReLU) activation function. This algorithm showed a minimum training time of only 3.07 s, the shortest training time of the algorithms, and a model size of 12 kB. Figure 5a shows the comparison between the predicted and true responses for the trials used for training. The values cluster near the bisector of the first quadrant, showing low deviations. To better understand the errors made, Figure 5b shows the residuals (difference between true and predicted responses) as a function of true responses. At zero pressure, i.e., for a bending angle of 0\({}^{\circ}\), an error is made with BNN's predictions. These residuals increase as the experimental response increases, but are at most 3.62\({}^{\circ}\). In the entire range of the true response (0-30\({}^{\circ}\)), the limited values of the residuals justify the possible use of BNN in the predictions. Thus, these images show that the BNN can predict responses of the bending angle \(\alpha\) as a function of the combinations of the four adopted parameters. \begin{table}
\begin{tabular}{l c c c c} \hline \hline
**Algorithm** & **Training RMSE (\({}^{\circ}\))** & **Validation RMSE (\({}^{\circ}\))** & **Training Time (s)** & **Model Size (kB)** \\ \hline Coarse Tree & 3.84 & 3.35 & 10.90 & 3 \\ Medium Tree & 2.68 & 1.84 & 12.05 & 4 \\ Fine Tree & 2.12 & 2.51 & 13.34 & 8 \\ \hline Linear SVM & 2.50 & 1.99 & 8.89 & 8 \\ Quadratic SVM & 1.48 & 1.37 & 7.37 & 6 \\ Cubic SVM & 1.38 & 1.22 & 6.79 & 6 \\ Medium Gaussian & 1.62 & 1.35 & 25.31 & 6 \\ SVM & 2.44 & 1.89 & 24.20 & 7 \\ SVM Kernel & 3.37 & 2.48 & 5.20 & 9 \\ \hline Efficient Linear Least & 2.38 & 1.97 & 22.95 & 11 \\ Square & 2.38 & 1.49 & 10.90 & 153 \\ \hline Boosted Trees & 1.84 & 1.49 & 10.90 & 153 \\ Bagged Trees & 2.07 & 1.33 & 8.71 & 165 \\ \hline Wide Neural Network & 0.92 & 0.98 & 10.54 & 10 \\
**Bilayered Neural Network** & **0.83** & **0.73** & **3.07** & **12** \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Performance results for different regression algorithms. Turning to the validation, in Figure 6a,b, the plots of the comparison between the predicted and true response and the residuals as a function of the true response are presented. In this case, the residuals are quite constant as a function of the true response, and the error is at most \(2.72^{\circ}\).