*2.5. Establishment of Dynamic Fresh Weight Growth Prediction Model*

Using the above methods, it was easy to obtain the optimum response time of the most significant correlations between cumulative environmental factors and the fresh weight growth of substrate-cultivated lettuce grown in a solar greenhouse. Thus, a dynamic fresh weight prediction model was constructed, using the collected data to predict the dynamic fresh weight growth of lettuce.

#### 2.5.1. Predicting the Fresh Weight on the Next Day

Firstly, a dataset labeled 1 is constructed using instantaneous fresh weight, cumulative environmental factors, and fresh weight increment in the previous *k* days from day 1 to day *n*0, with a total of *n*<sup>0</sup> − *k* elements. The dataset labeled 1 is imported into the naive Bayesian network for training and testing of the model. Then, instantaneous fresh weight on day *n*<sup>0</sup> − *k* + 1 and cumulative environmental factors from day *n*<sup>0</sup> − *k* + 1 to day *n*<sup>0</sup> + 1 are taken as the inputs of the above model, and the fresh weight increment from day *n*<sup>0</sup> − *k* + 1 to day *n*<sup>0</sup> + 1 is derived by substituting the above model. Finally, the instantaneous fresh weight on day *n*<sup>0</sup> + 1 is calculated and the relative error is calculated. The specific calculation formula is as follows:

$$m\_{n0}' = m\_k + \Delta m\_{n0-k}' \tag{13}$$

$$RE = \frac{\left| m\_{n0-}^{\prime} \cdot m\_{n0} \right|}{m\_{n0}} \tag{14}$$

$$MRE = \frac{1}{n} \sum\_{i=1}^{n} RE\_i \tag{15}$$

$$
\sigma = \sqrt{\frac{1}{n-1} \sum\_{i=1}^{n} (RE\_i - MRE)^2} \tag{16}
$$

where Δ*m <sup>n</sup>*0−*<sup>k</sup>* is the predicted value of fresh weight increment from day *<sup>n</sup>*<sup>0</sup> to day *<sup>k</sup>* (g), *mk* is the measured value of instantaneous fresh weight on day *k* (g), *m <sup>n</sup>*<sup>0</sup> is the predicted value of instantaneous fresh weight on day *n*<sup>0</sup> (g), *mn*<sup>0</sup> is the measured value of instantaneous fresh weight on day *n*<sup>0</sup> (g), *RE* is the relative error between the predicted value and measured value of instantaneous fresh weight (%), *MRE* is the mean relative error (%), and *σ* is the standard deviation of relative error (%).

#### 2.5.2. Predicting the Fresh Weight in the Next 2 Days

<sup>1</sup> Using the method of predicting the fresh weight on the next day, the fresh weight increment from day *n*<sup>0</sup> − *k* − 1 to day *n*<sup>0</sup> + 1 can be obtained.

<sup>2</sup> The instantaneous fresh weight on day *n*<sup>0</sup> − *k* + 1, cumulative environmental factors, and predicted fresh weight increment from day *n*<sup>0</sup> − *k* + 1 to day *n*<sup>0</sup> + 1 are taken as the last element group to construct a new dataset labeled 2, with a total of *n*<sup>0</sup> − *k* + 1 elements. The dataset labeled 2 is imported into the naive Bayesian network for training and testing of the model.

<sup>3</sup> The cumulative environmental factors from day *n*<sup>0</sup> − *k* + 2 to day *n*<sup>0</sup> + 2 and the instantaneous fresh weight on day *n*<sup>0</sup> − *k* + 2 are taken as the inputs of the above model, and the fresh weight increment from day *n*<sup>0</sup> − *k* + 2 to day *n*<sup>0</sup> + 2 is derived by substituting them into the above model.

<sup>4</sup> With reference to Equations (13) and (14), the instantaneous fresh weight on day *n0 +* 2 and the relative error are calculated.
