This section presents the results obtained by applying three models: DT, RR, and SVR to predict the concentration distribution in the drying process of pharmaceuticals. Various performance metrics were used to evaluate the model, including coefficient of determination (R²), RMSE, MAE, and maximum error. The final optimized hyperparameters obtained using DA are shown in Table 1.
Model performance metrics
The R² scores for both the training and testing subsets are summarized in Table 2. The SVR model has the highest R² score, demonstrating better predictive accuracy and generalization compared to the DT and RR models.
Table 3 compares the error rates for RMSE, MAE, and maximum error tests. The SVR model consistently performed better than other models, achieving the lowest error rate across all metrics.
Additionally, to demonstrate the impact of DA hyperparameter tuning, we compared the performance of each model before and after optimization, as shown in Table 4. All three models showed significant improvements with optimization. Specifically, the SVR model showed the most significant improvement, increasing the R² test score from 0.9047 to 0.9992 after applying DA. Similarly, both decision tree and ridge regression models showed improved R² scores, highlighting the effectiveness of DA in fine-tuning hyperparameters and improving predictive accuracy across all models. These results highlight the important role of hyperparameter optimization in enhancing model performance and generalization, especially in complex tasks such as concentration prediction in pharmaceutical processes.
comparative analysis
figure. Figures 3, 4, and 5 display the actual concentration values versus the predicted concentration values produced by the three models. The SVR optimized by the Dragonfly algorithm outperformed both the decision tree model and the ridge regression model across all metrics evaluated. SVR’s very high R² scores (0.999234 on the test set and 0.999187 on the training set) demonstrate its ability to accurately model the underlying patterns in the data. The minimal difference in R² scores between training and testing also indicates that the SVR model generalizes well to unseen data, reducing the risk of overfitting.

True concentration value compared to predicted concentration value using DT.

True concentration value compared to predicted concentration value using RR.

True concentration value compared to predicted concentration value using SVR.
Error metrics further validate the performance of the SVR model. The RMSE of 1.2619E-03 and MAE of 7.78946E-04 are significantly lower than the other models, reflecting the accuracy of the model in predicting the concentration of the compound. Moreover, the maximum error of SVR was the lowest at 5.18029E-03, indicating that even the most difficult predictions had consistent accuracy.
Overall, the SVR model improved by the Dragonfly algorithm accurately and reliably predicts chemical concentrations in spatial contexts, making it a suitable option for applications in chemical engineering and related fields. Therefore, we designate this model as the top performer in our study. Throughout this model, the clear influence of coordinates on the output is shown in Figures 1 and 2. 6, 7, 8.
Although the SVR model clearly outperforms DT and RR in terms of prediction accuracy, it requires more computational resources due to kernel operations and hyperparameter tuning. In contrast, DT and RR provide faster training and inference, which can be advantageous in real-time monitoring scenarios where quick feedback is important. Therefore, while SVR is well-suited for offline modeling and optimization, DT or RR may serve as a lightweight alternative in industrial drying systems where computational efficiency is prioritized over modest gains in accuracy.
Five-fold cross-validation was performed on the optimized SVR model to further ensure robustness and reduce possible biases resulting from a single training and testing split. The average R² across folds is 0.99891, and the scores per fold range from 0.99873 to 0.99912, indicating consistently high prediction accuracy. Similarly, the average RMSE and MAE values across the fold were 1.39E-03 and 8.42E-04, respectively, both of which remained close to previously reported single-split results. These findings confirm that the SVR model maintains strong generalization ability across multiple data partitions, further supporting its suitability for industrial drying system simulations.
The superior accuracy of the SVR model compared to DT and RR may be related to its ability to more effectively model the complex nonlinear relationship between spatial coordinates and concentration values. Although decision tree algorithms are highly interpretable, they often struggle with smooth function approximations and can overfit local patterns in dense datasets, even with pruning. Because ridge regression is a linear method, it is inherently limited in capturing nonlinear trends that exist in drying processes that involve complex interactions between mass transfer dynamics and spatial variables. In contrast, SVR exploits kernel tricks, particularly optimized radial basis function (RBF) kernels, to project data into a high-dimensional space, allowing subtle nonlinear dependencies to be captured. Hyperparameter optimization further enhanced the ability to generalize, as reflected in near-perfect R² scores and minimal error metrics. This indicates that SVR is inherently suitable for modeling highly nonlinear and high-dimensional relationships in pharmaceutical drying simulations.
To further examine the robustness of the model, we performed a simple uncertainty analysis by perturbing the input coordinates with small random fluctuations (± 0.48–1% of value). The SVR predictions were very stable, with only a slight decrease in R² values (from 0.9992 to 0.9987) and an increase in RMSE of less than 8%. This negligible degradation highlights the resilience of the model to input noise and indicates reliable generalization under realistic experimental variations. Such robustness is especially important in industrial applications where measurement inaccuracies and process perturbations are unavoidable.
Interpretation of visualization
To better understand the predicted behavior of the optimized model, several visualizations are generated using the model showing the relationship between spatial coordinates (X, Y, Z) and predicted concentration values in the system. These plots provide intuitive insight into concentration gradients, spatial dependence, and the influence of individual variables on model predictions, complementing previously reported numerical performance metrics.
Figure 6 shows how the X coordinate affects the predicted concentration (C) when fixed at Y = 0 and Z = 0.01. The nonlinear curve shows a smooth change in concentration along the X axis, indicating its role in the drying process. The SVR model accurately captures these variations with specific X-value peaks that reflect spatial gradients within the sample.

Partial dependence of concentration-X(m) (y = 0, z = 0.01).
Figure 7 shows the influence of the Y coordinate on the concentration (C) with X = 0 and Z = 0.01 as constants. The plot shows a nonlinear trend in concentration across Y values. The SVR model effectively detects these changes and highlights the regions of high solute retention and the influence of the Y coordinate on the drying dynamics. The lowest sample concentration observed is likely the result of a concentration gradient across the sample and mass transfer within the system by molecular diffusion.

Partial dependence of concentration – Y(m) (x = 0, z = 0.01).
Figure 8 shows the effect of the Z coordinate on the predicted concentration (C) when fixing X = 0 and Y = 0. The concentration decreases almost linearly with increasing Z, suggesting a consistent and strong decrease along the Z axis, which is probably related to water removal during drying.

Partial dependence of concentration – Z(m) (x = 0, y = 0).
figure. Figures 9, 10, and 11 are 3D plots showing the combined effect of spatial coordinates on predicted concentration (C) in a pharmaceutical drying process modeled by SVR. Figure 9 shows the influence of the X and Z coordinates (Y = 0 fixed), showing a nonlinear surface where Z causes a steeper concentration gradient, indicating its strong influence. Figure 10 shows the effect of X and Y (Z = 0.01 constant), revealing a nonlinear surface with concentration peaks and highlighting the complex XY interactions. Figure 11 shows the influence of Y and Z (X = 0 fixed), with Z dominating the concentration decrease and Y contributing to more subtle fluctuations. The SVR model accurately captures these nonlinear spatial dependencies and demonstrates its effectiveness in simulating drying dynamics.

Concentration as a function of X(m) and Z(m) – constant Y = 0.

Concentration as a function of X(m) and Y(m) – constant Z = 0.01.

Concentration as a function of Y(m) and Z(m) – constant X = 0.
Additionally, the 3D in Figure 12 clearly shows the concentration gradient, effectively showing that Z(m) primarily influences the predicted concentration. It can be observed that the concentration of solute changes during the drying process which is a result of mass transfer within the sample. The model can also be built to track concentration and time to see when a target point is reached to stop the drying process. Therefore, the overall results revealed that the combination of mass transfer and machine learning is a useful strategy to optimize the freeze-drying process and find the optimal drying time.11. A similar trend is observed in the prediction of T distribution for freeze-drying processes by ML.11,15.

Relationship between X(m), Y(m), Z(m) and predicted concentration.
In this work, we focused on three representative baseline models (DT, RR, and SVR) to provide transparent comparisons under consistent optimization conditions, but we recognize that further improvements may be achieved by more advanced approaches such as random forests, gradient boosting, and neural networks. Moreover, emerging paradigms such as graph representation learning have shown promising results in engineering applications and may provide powerful ways to capture spatial dependence in future research.34,35. Nevertheless, in this work, we intentionally limited the scope to a single model to maintain interpretability, reduce computational load, and clearly demonstrate the performance gains achievable with Dragonfly algorithm-based hyperparameter tuning. Despite the promising results, several limitations must be acknowledged. First, this study relies on a simulated dataset and validation by real experiments is required to confirm the robustness of the proposed model under real dry conditions. Second, although the Dragonfly algorithm has improved prediction accuracy, its computational cost may limit its scalability for large-scale industrial systems. Finally, the present study focused only on spatial concentration prediction. Future studies may extend the framework to incorporate temporal dynamics, excipient composition variations, or process perturbations commonly encountered in pharmaceutical drying environments.
