## 2 Materials and Methods
### Ensemble Model for Improved Grain Yield Predictions  
This section presents an ensemble machine learning (ML) model designed to enhance the accuracy and reliability of grain yield predictions by harnessing the strengths of multiple individual models. Ensemble models have emerged as a prominent technique in agricultural data analysis due to their capacity to mitigate limitations and improve accuracy by effectively capturing diverse patterns and relationships in the data. By combining the predictive power of multiple ML algorithms, the ensemble model contributes to more robust and accurate grain yield predictions. Within our ensemble model, we meticulously selected a range of top-performing machine learning (ML) algorithms, including Huber regression, M estimators, linear regression, ridge regression, and others, based on their demonstrated effectiveness in capturingtemporal variations, addressing multicollinearity, and accommodating outliers present in the dataset. The operational framework of the ensemble model is structured as follows:  
* Data preparation: To combine the data from various sources, we collected the following:
* Twenty-four VIs with the CD and CV (Clgr, CIre, EVI2, GNDVI, MCARI2, MTVI2, NDRE, NDVI, NDWI, OSAVI, RDVI, and RGBVI). * Sixteen environmental data (maize height, N, P, K, pH, soil temperature, soil humidity, EC, water feed, UV radiation, evapotranspiration, daily rain, rain rate, humidity, wind speed, temperature). In summary, we have forty features with two hundred seventy data plots on each of the seventeen dates to process, with in total 137,700 records from the dataset. In addition, data cleaning, missing value handling, and null entry removal were also included:  
* Feature engineering: Use six different feature importance techniques to extract significant features:
* Random forest importance consists of a large number of individual decision trees that operate as an ensemble. Each individual tree in the random forest outputs a class prediction, and the class with the most votes becomes the model prediction. The importance of each feature is determined by the average impurity decrease calculated from all decision trees in the forest. * Recursive feature elimination (RFE) with cross-validation is a method that fits the model multiple times, and at each step, it removes the weakest feature (or features). RFE with cross-validation uses the cross-validation approach to find the optimal number of features. * Permutation importance can be used with any model. After a model is trained, the values in a single column of the validation data are randomly shuffled. Then, the model performance metric (such as accuracy or \(R^{2}\)) is re-evaluated with the shuffled data. Features that have a significant impact on performance are considered important. * LASSO regression coefficients is a regression analysis method that performs both variable selection and regularization to enhance the prediction accuracy and interpretability of the statistical model. LASSO selects features with non-zero coefficients. * The correlation coefficient measures the linear relationship between the target and the numerical features. Features that have a higher correlation with the target variable are considered important. * SHapley Additive exPlanations (SHAP) is a unified measure of feature importance. It assigns each feature an important value for a particular prediction. * Model selection: We meticulously evaluated the performance of various ML algorithms on our grain yield prediction task. The top arbitrary number models, based on evaluation metrics such as mean-squared error (MSE), root-mean-squared error (RMSE), mean absolute error (MAE), and R-squared (\(R^{2}\)), were chosen for ensemble construction. * Training: Each of the selected models was trained on our dataset, utilizing the same training, testing, and validation splits of 70%, 20%, and 10%, respectively, to ensure consistency and fairness in the comparison. Fourteen different ML models were trained and evaluated for the data.