## 3 Methodology
### Construction of Color Harmony Prediction Model
#### 3.2.2 Model Training  
This study attempts to apply both linear and nonlinear machine learning algorithms to regression model construction to explore the relationship between multi-color physical features and color harmony. After loading the dataset, data preprocessing was performed, including removing non-numeric columns and imputing missing values to ensure data integrity. The target variable and feature variables were separated, and the dataset was randomly split into a training set (80%) and a test set (20%). After training the 11 machine learning models, a comparison of the prediction results is shown in Table 1.  
From the model evaluation results, nonlinear algorithms (such as CatBoost, XGBoost, and LightGBM) outperformed linear algorithms overall. Specifically, CatBoost achieved the best performance across all evaluation metrics, exhibiting the lowest MSE, MAE, RMSE, and MAPE while maintaining high R\({}^{2}\) and adjusted R\({}^{2}\) values, indicating its superior data fitting and predictive accuracy. XGBoost and LightGBM followed closely, performing slightly worse than CatBoost but still proving to be strong candidates. In contrast, linear algorithms such as ElasticNet showed weaker performance, particularly in MSE and R\({}^{2}\), leading to higher prediction errors and weaker fitting ability. In summary, nonlinear models, particularly CatBoost, demonstrated the best performance in color harmony prediction tasks, effectively capturing complex relationships in the data. For large-scale datasets, XGBoost and LightGBM also present promising alternatives. Overall, selecting an appropriate model significantly impacts task performance. To further improve the prediction performance, we selected the three best-performing models from individual training: CatBoost, XGBoost, and LightGBM. These three models performed better than others based on mean squared error (MSE) and the coefficient of determination (R\({}^{2}\)), so we chose them as base learners for ensemble training, with the aim of improving prediction accuracy through ensemble learning. We adopted a stacking model as the ensemble method, which combines the predictions from multiple base learners and feeds them into a meta-learner for the final prediction. Stacking effectively leverages the independent advantages of each base learner, while the meta-learner adaptively learns how to optimally combine their predictions to maximize the model's prediction performance. In this experiment, we selected a linear regression model as the meta-learner to combine the outputs from the base learners for final regression prediction. The ensemble model was trained using the training set. Each base learner was trained individually and generated its predictions. Then, the meta-learner used these predictions as inputs to generate the final prediction. After training the ensemble model, we evaluated it on the test set. By calculating several evaluation metrics, we obtained MSE = 0.0382, R\({}^{2}\) = 0.6552, MAE = 0.1543, RMSE = 0.1954, MAPE = 0.0524, and adjusted R\({}^{2}\) = 0.6312. The results showed that the ensemble model outperformed the individual base learners, especially in terms of MSE