# Random Forest-Based Prediction of the Optimal Solid Ink Density in Offset Lithography
## 3 Materials and Methods
### Hyperparameter Optimization in Random Forest Algorithms  
The performance of the model critically depends on the selection of hyperparameters, which must be thoroughly discussed and determined prior to constructing a Random \begin{table}
\begin{tabular}{c c c} \hline \hline
**Name** & **Default Value** & **Description** \\ \hline n\_estimators & 100 & The number of decision trees to control the complexity and stability of the model. \\  & & The maximum depth of the tree. If the value is “none” the node will continue unless all leaves are pure. \\ min\_samples\_split & 2 & The minimum number of samples required to divide nodes. \\ max\_leaf\_num & None & Maximum number of leaf nodes. \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Hyperparameters in the Random Forest algorithm. Figure 4: Flow chart of optimal solid ink density prediction model. Forest model. Table 4 presents the hyperparameters commonly required for configuring the Random Forest model. Key hyperparameters include the minimum number of samples required to split a node, the number of decision trees, the maximum depth of trees, the maximum number of features considered for splitting, and the maximum number of leaf nodes [27; 28; 29]. These parameters are typically determined empirically, and their relative importance varies depending on the dataset employed. For most datasets, only a limited subset of hyperparameters significantly influences model outcomes. Notably, the number of decision trees and the maximum tree depth exhibit the highest prioritization, followed by the minimum samples required for node splitting and the maximum leaf node constraints. Due to the limited sample size in this study and the fact that the maximum tree depth constrains the impact of the minimum leaf node count on the forest, the maximum depth and maximum node count were set to their default values. Instead, optimization focused on the minimum number of samples required for node splitting and the number of decision trees, as these have a greater influence on the model's performance. Since the interaction between the two hyperparameters is minimal, each hyperparameter can be optimized independently. (1) Determine the number of decision trees  
The Random Forest model's size is determined by the quantity of decision trees. According to earlier research, the Random Forest prediction model's capacity for generalization steadily stabilizes as the number of decision trees rises. An overabundance of decision trees, however, may slow down the model's pace of convergence and reduce its applicability in real-world scenarios. For this reason, choosing the right number of decision trees is essential when building a model. Since the sample size in this study is small, the number of decision trees was set within the range from 0 to 300 during the construction of the model. The ideal parameters are chosen by comparing the mean squared error (MSE) values for various numbers of decision trees after the corresponding MSE values for the three colors are determined independently. Figure 5 displays the MSE values for varying numbers of decision trees. The vertical axis shows the MSE values, and the horizontal axis shows the number of decision trees. Based on the training results of the three ink datasets, the MSE reached its minimum when the number of decision trees was set to 100 for cyan ink, 50 for magenta ink, and 100 for yellow ink. Currently, the model performance is the best. Therefore, it can be concluded that the model's output is optimal when the number of decision trees is set to the above-mentioned values. (2) Determine the minimum number of nodes  
The \"min_samples_split\" parameter in decision trees defines the minimum number of samples required to divide an internal node. Specifically, if a node contains fewer samples than the defined threshold, it remains a leaf node and is not further divided. Adjusting the \"min_samples_split\" parameter regulates tree growth, preventing excessive complexity, mitigating overfitting, and enhancing training efficiency.