# Analysis and Prediction of Carsharing Demand Based on Data Mining Methods
## 3 Prediction of Carsharing Demand Based on GBDT
### GBDT Algorithm Process  
GBDT is a strong classifier formed by integrating many tree models and is a kind of boosting integration algorithm. The tree model in GBDT is the CART regression tree. The CART tree is divided into classification tree and regression tree, which includes three processes: characteristic selection, tree generation, and pruning. The CART regression tree is mainly used to learn and predict continuous values. 1. Building the CART regression tree  
A binary tree is constructed recursively. Training data set D is continuously input into space and divided into two subregions. The optimal output value of each subregion is calculated. Training data set D is input, and the CART regression tree is output. If the generated regression tree is not pruned, then overfitting occurs easily. To ensure that the model is not overly complex, pruning operation should be carried out. The branches and leaves at the bottom of the CART regression tree are cut off, thus simplify \begin{table}
\begin{tabular}{c c} \hline \hline
**Characteristics** & **Description** \\ \hline \(x_{d}(t-1),x_{d}(t-2),\ldots,x_{d}(t-6)\) & Number of vehicles picked up in the first six \\ \(m_{d}(t-1),m_{d}(t-2),\ldots,m_{d}(t-6)\) & Periods of the prediction period \\ \(x_{d-1}(t),x_{d-2}(t),\ldots,x_{d-28}(t)\) & Number of vehicles picked up in the same \\  & period 28 days before the prediction period \\ \(m_{d-1}(t),m_{d-2}(t),\ldots,m_{d-28}(t)\) & Number of vehicles returned in the same \\  & period 28 days before the prediction period \\  & Statistics of the number of picked-up vehicles \\ \(Avg\_x_{d-\text{m}}(t),Med\_x_{d-\text{m}}(t),Var\_x_{d-\text{m}}(t)\) & in the same period of 28 days before the \\  & prediction period, including the maximum, \\  & minimum and variance \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Number of historical pick-ups and returns, and its time characteristics. ing the regression decision tree, enhancing the generalization ability, and improving the accuracy of the model. The CART generation algorithm uses the decision tree as input and optimal decision tree as output. 2. GBDT algorithm framework  
Objective function and optimization  
GBDT is a kind of supervised learning. The establishment of GBDT requires a large number of labeled datasets \(\left(x_{i},y_{i}\right)^{N}\) to support where \(N\) is the size of the sample set, and \(x_{i}\in R^{d};y_{i}\) is the label value. GBDT aims to give an estimation function \(\hat{f}(x)\) for the real function \(f:x\to y\). GBDT also aims to minimize the loss function \(L(y,\hat{f}(x))\) to improve the prediction accuracy of the model. The estimation function is shown in Formula (5). \[\hat{f}(x)=\underset{f(x)}{\operatorname{argmin}}L(y,\hat{f}(x)) \tag{5}\]  
Formula (5) can be written in the form of a function that minimizes the expected loss as follows:  
\[\hat{f}(x)=\underset{f(x)}{\operatorname{argmin}}E_{x}[E_{y}[L(y,\hat{f}(x))] |x]. \tag{6}\]  
To make the goal of the problem more concrete, the search space is limited by parameter \(\theta\). The formula is as follows:  
\[\hat{\theta}=\underset{\theta}{\operatorname{argmin}}E_{x}[E_{y}[L(y,\hat{f}(x,\theta))]|x]. \tag{7}\]  
Recursive numerical processes are usually used for optimization to solve the problem that the above functions may not have closed-form solutions. To improve the capability of the model, the value of the loss function in the negative gradient direction of the current model: \(-[\partial L(y,f(x_{i}))/(\partial f(x_{i})]\) is used to approximate the function residual and fit the regression tree. GBDT is carried out to solve and predict by using the recursive method. At each stage of solving \(m\), starting from the weak classifier \(F_{m}(x)\), a better model is obtained by adding estimator \(h(x)\) based on \(F_{m}(x)\). As shown in Formula (8),  
\[F_{m+1}(x)=F_{m}(x)+h(x). \tag{8}\]