*3.3. Using Batch Data to Predict the Dynamic Fresh Weight of Lettuce*

It is obvious from Figure 8 that the fresh weight on the next day can be predicted by using only the data from the current batch (MRE1 = 6.25%, σ<sup>1</sup> = 7.05%). The relative error (Figure 9) of predicting fresh weight using only the data from the current batch fluctuated greatly at first, and there was one point with a relative error of 40.9%. Subsequently, the relative error fluctuation began to stabilize. This is mainly because the number of elements constructed from the data of the current batch was relatively small at the initial stage, and the accuracy of the model trained by the naive Bayesian network was relatively low. With the increase of the number of elements in the dataset, the accuracy of the model trained by the naive Bayesian network gradually improved, and the relative error started to decrease.

It can be seen from Table 2 that only the data from the current batch were used to predict fresh weight, and the relative error gradually increased with the increasing number of future days (MRE: 6.25% < 6.50% < 7.88%, σ: 7.05% < 6.76% < 11.17%). The data from the current batch with the introduction of another batch were used to predict fresh weight, and the relative error had a tendency to increase with the increasing number of future days (MRE: 4.86% < 5.57% < 6.50%, σ: 5.77% < 6.04%, 5.77% < 5.78%). The data from the current batch with the introduction of another two batches were used to predict fresh weight, and the relative error gradually increased with the increasing number of future days (MRE: 4.35% < 5.40% < 5.29%, σ: 4.87% < 5.38% < 6.11%).

**Figure 8.** Prediction of fresh weight on the next day. Note: Predicted value 1 is the value of fresh weight on the next day predicted using the data of the current batch. Predicted value 2 is the value of fresh weight on the next day predicted by introducing another batch. Predicted value 3 is the value of fresh weight on the next day predicted by introducing the data from another 2 batches.

**Figure 9.** The relative error of predicting fresh weight using only the data from the current batch.



As shown in Figure 10, the data from the current batch were used to predict the fresh weight in the future. With the increasing number of future days, the MRE of fresh weight prediction gradually increased. In other words, the accuracy of predicting fresh weight in the future gradually decreased, and the MRE of fresh weight prediction over 4 days based on data from the current batch was not more than 9.57%.

**Figure 10.** Comparison chart of the mean relative error of predicted future fresh weight.

Upon introducing another batch of data, the MRE of fresh weight prediction gradually increased with the increasing number of future days. However, it was lower than that of the fresh weight predicted using only the data from the current batch, and the MRE of fresh weight prediction in the next 7 days based on the introduction of another batch of data was not more than 8.53%, indicating that the accuracy of predicting fresh weight was improved by introducing another batch.

After introducing the data from another two batches, the MRE of fresh weight prediction tended to increase with increasing number of future days. However, it was lower than that for the fresh weight predicted using the data with only one additional batch, and the MRE of fresh weight prediction over 9 days based on the introduction of data from another two batches was not more than 9.68%, indicating that the accuracy of the fresh weight prediction could be further improved by introducing more batches.

#### **4. Conclusions and Future Work**

A dynamic fresh weight growth prediction model based on phenotypic and environmental batch data was proposed, and was used to predict the dynamic fresh weight growth of substrate-cultivated lettuce in a solar greenhouse under normal water and fertilizer conditions. The computation of cumulative environmental factors and instantaneous fresh weight of batches of lettuce was achieved. The optimum response days were explored through the most significant correlations between cumulative environmental factors and fresh weight growth. A dynamic fresh weight prediction model was established using a naive Bayesian network based on cumulative environmental factors, instantaneous fresh weight, and fresh weight increments of batches. Experimental results showed that the calculation time setpoint of cumulative environmental factors and instantaneous fresh weight of lettuce was 8:00 AM and the optimum response time was 12 days. The MRE of fresh weight prediction over 4 days based on data from the current batch was not more than 9.57%; upon introducing another batch of data, the prediction over 7 days dropped to not more than 8.53% MRE; upon introducing another two batches, the prediction over 9 days dropped to not more than 9.68% MRE, proving the model's feasibility.

In future work, the proposed dynamic growth prediction model of fresh weight will be integrated with an automatic management system and sensing data to support an autonomous fertigation strategy for substrate-cultivated leafy vegetables in a solar greenhouse system, playing an important role in promoting the automatic cultivation and management of vegetables in agricultural applications.

**Author Contributions:** L.L.: writing—original draft, conceptualization, methodology, investigation, data curation, software, and validation. J.Y.: writing—review and editing, conceptualization, and funding acquisition. X.W.: investigation. X.L.: writing—review and editing, formal analysis, funding acquisition, and project administration. L.G.: writing—review and editing, funding acquisition, project administration. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was supported by the National Natural Science Foundation of China (52275262), and the Shanghai Science and Technology Innovation Action Plan Project (21N21900100).

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Anyone can access the data by sending an email to jyuan@sdau.edu.cn.

**Conflicts of Interest:** The authors declare no conflict of interest.
