# Greenhouse Temperature Prediction Based on Time-Series Features and LightGBM
## 3 Proposed Methodology  
The proposed method is based on LightGBM, which is a framework for implementing the gradient boosting decision tree (GBDT) algorithm developed by Microsoft. The GBDT algorithm is an iterative-based decision tree algorithm. It uses the classification and regression tree model as the weak learner. The new learner is established in the direction that the gradient of the loss function of the previous learner falls, and the new learner is then iteratively generated to train the model [17]. In the iterative process, the next round of prediction is based on the residual between the predicted value and the real value of the previous round, and all the predicted results are added as the conclusion. The GBDT algorithm can therefore be expressed as the optimization process of decision tree learning with an additive model and forward step algorithm [18]:  
\[F_{M}(X)=\sum\
olimits_{m=1}^{M}f_{m}(X), \tag{1}\]  
where \(f_{m}(X)\) represents the decision tree. \(M\) is the number of trees and the number of iterations. The boosting tree is initialized as:  
\[F_{0}(X)=0.\]  
According to the forward step-by-step algorithm, the model of the \(m\)-th step can be expressed as:  
\[F_{m}(X)=F_{m-1}(X)+f_{m}(X), \tag{2}\]  
where \(F_{m-1}(X)\) is the current model and \(f_{m}(X)\) is the current decision tree. Taking the squared loss as the loss function and supposing that there is a sequence \(X\):\(x_{1},x_{2},x_{3},\ldots,x_{n}\) and corresponding true values \(Y\): \(y_{1},y_{2},\cdots,y_{n}\), the loss function is defined as:  
\[L(Y,F_{m}(X))=\frac{1}{n}{\sum\
olimits_{i=1}^{n}}((y_{i}-F_{m}(x_{i}))^{2}). \tag{3}\]  
The first derivative of the loss function is:  
\[L^{\prime}(Y,F_{m}(X))=-\frac{2}{n}{\sum\
olimits_{i=1}^{n}}(y_{i}-F_{m}(x_{ i})). \tag{4}\]  
The second derivative of the loss function is:  
\[L^{\prime\prime}(Y,F_{m}(X))=2. \tag{5}\]  
Furthermore, according to Formula (4), we obtained the first derivative of the loss function as:  
\[L^{\prime}(Y,F_{m}(X))=L^{\prime}(Y,F_{m-1}(X)+f_{m}(X)) \tag{6}\]  
while according to the first-order expansion of the Taylor formula,  
\[f(x+x_{0})=f(x)+f^{\prime}(x)\times x_{0}, \tag{7}\]  
We have:  
\[L^{\prime}(Y,F_{m}(X))=L^{\prime}(Y,F_{m-1}(X))+L^{\prime\prime}(Y,F_{m-1}(X)) \times f_{m}(X). \tag{8}\]  
We obtained the best tree when \(L^{\prime}(Y,F_{m}(X))=0\). It follows that:  
\[f_{m}(X)=-\frac{L^{\prime}(Y,F_{m-1}(X))}{L^{\prime\prime}(Y,F_{m-1}(X))} \tag{9}\]  
According to Formulas (6) and (7):  
\[F_{0}(X)=0.\]0  
and it follows from Formula (4) that:  
\[F_{0}(X)=0.\]1Finally, we obtained the strong learner as:  
\[F_{0}(X)=0.\]2  
In the above formula, \(n\) is the total number of samples. The model of the optimal solution was obtained by iteration. The conventional implementation of the GBDT requires the scanning of all the data instances to estimate the information gain of all the possible split points [19]. The implementation is thus time-consuming when handling big data. LightGBM uses a histogram-based algorithm (Histogram) to traverse each segmentation point, which consumes less memory and reduces the complexity of data separation to speed up the training process. It also uses the gradient-based one-side sampling algorithm to reduce a large amount of data with only small gradients, uses the exclusive features bundling algorithm to bind many mutually exclusive features into one feature, and uses the leaf-wise strategy to grow trees and find the leaf with the largest gain of variance for the split [20]. LightGBM thus has the advantages of faster training, lower memory consumption, better accuracy, and quicker processing of massive data. LightGBM is therefore widely used for ranking, classification, prediction, and many other machine learning tasks [21; 22; 23; 24; 25].