# Optimization of CART Models Using Metaheuristics for Predicting Peach Firmness
## 5 Results  
Compared to the last experiment described in [1], multiple regression tree models are optimized and compared to gain a more accurate estimate of the performance of the optimization algorithms. In addition, a new approach in regression tree model optimization has been selected, in which the complexity parameter (CP) is being optimized and used in pruning the overgrown trees. A total of 1000 default pruned trees have been created and their performance compared with 1000 overgrown models optimized using each metaheuristic algorithm described in this paper. Eighty percent of the randomly selected dataset observations are used to train the models, and the remaining twenty percent are used to test them. The test data consist of 40 observations and are used to estimate the accuracy of the developed machine learning models, whereas 160 observations make up the training data used to train the models. When using the _rpart_ R library to build the default pruned tree, the pruning of the tree is performed automatically by selecting the CP value that produces the minimum error on validation data during the cross-validation procedure. Below each decision node is the yes-no conditional based on which the split is made. The mean value of firmness, which is calculated using observations that satisfy the conditions given by the decision nodes, is contained inside each decision and terminal node. The approach in CART model optimization is to optimize the CP value using nature-inspired metaheuristics and use it to prune back the purposely overgrown CART model. The lower and upper bounds of the CP search space for all optimization algorithms are 0.00001 and 1, respectively. The optimization problem is set up to maximize the objective function; thus, the CP value with the highest fitness score will be selected. The set parameters of the genetic algorithm implemented in the \(GA\) R library are population size, whose value is 200, and the number of best individuals to survive in each generation, which is set to 40 percent. The GA parameter values are determined experimentally with the goal of obtaining the best CART optimization performance. The parameter values for other metaheuristics that follow are obtained in the same way. All other nature-inspired metaheuristics are implemented using the _metaheuristicOpt_ R package. The population size parameter of the bat algorithm is set to 40, and the maximum and minimum frequencies are set to 0.1. The default value of 1 is assigned to the factor that increases pulse rate, while the value of 0.1 is assigned to the factor that decreases loudness. In the DE algorithm, each individual in the generation is permitted to mate with other randomly selected individuals. The crossover probability factor is set to 0.5, and the mutation operator's scaling factor is set to 0.8. The size of the population is 20. When implementing the PSO as a CART optimization algorithm, the inertia weight is set to 0.729. The value of 1.49445 is set for both the individual and group acceleration constants, while the population size is 20. For the dragonfly algorithm (DA), gray wolf optimizer (GWO), black hole optimization (BHO) algorithm, and whale optimization algorithm (WOA), the population size is set to 40 and the maximum number of iterations is 500. To compare the performance of default and optimized CART models, multiple other machine learning models are introduced. These are MLR, ANFIS, ANN, bagged decision trees, boosted trees, and random forests. The mentioned models are implemented by the _frbs nnet, ipred, XGBoost_, and _randomForest_ R packages, respectfully. The optimal parameters of the developed machine learning models were obtained using an automated parameter tuning technique implemented in the _care_ R package. Machine learning parameter tuning is the process of adjusting the model options with the goal of identifying the best fit. In the tuning process, a repeated 10-fold cross-validation is used as the resampling method.