## 4 The Missing Data Completion Algorithm Based on Residual Value Tensor Decomposition
### Features Extraction and Residual Value Tensor Construction  
The traffic flow tensor can simultaneously represent spatial features and temporal features. The spatial features in traffic flow tensor are reflected by the data of adjacent links are also closely arranged in the dimension of \"links\". The temporal feature is the most important feature of traffic flow data, which needs to be fully utilized. The temporal features have different granularity, such as \"day-hour trend\" features and \"hour-minute trend\" features. The \"day-hour trend\" features refer to the similar data distribution at the same hour of the day. For example, on a link of road network, there is less traffic volume between 5:00 am and 5:59 am. Moreover, there is a higher volume of traffic between 8:00 am and  
Figure 2: Traffic flow data tensor. 8:59 am. The \"day-hour trend\" features can be extracted for 24 h in a day, which can be calculated as follows:  
\[\overline{x}_{h}^{d,n}=\frac{\sum\limits_{i=h*(60/\tau)+1}^{(h+1)*(60/\tau)}x_{i} ^{d,n}}{60/\tau} \tag{9}\]  
where \(h=0,1,2,\ldots,23\), and it represents 24 h in a day. \(d\) and \(n\), respectively, represent number of days and number of links. \(\tau\) is the size of the time slice, and \(60/\tau\) is the total number of time slices in an hour, and \(i\) is sequence number of time slices. For example, if the sample data are collected in two minutes, there are 30 time slices in an hour. The corresponding sequence number of time slices for each hour is shown in Figure 3. \(\overline{x}_{h}^{d,n}\) is the mean value of data of time slices within each hour in every day, where the data are grouped by link-ID before computing. The size of \(\overline{x}_{h}^{d,n}\) is same as the original traffic flow tensor, and the data at the same hour in the same day are equal. The \"hour-minute trend\" features refer to that the data of every time slice have similar distribution in different days. For example, on a link of road network, although the data of time slices at 5:00 am differ from that at 5:59 am, the data of time slices at 5:00 am are very similar each day. The \"hour-minute trend\" features are fine-granularity features, which can be calculated as follows:  
\[\overline{x}_{m}^{d,n}=\frac{\sum\limits_{j=1}^{D}x_{m}^{j,n}}{D} \tag{10}\]  
where \(m=1,2,\ldots,T-1,T\), and it represents sequence number of time slices. \(d\) and \(n\), respectively, represent the number of days and the number of links. \(D\) is the total number of days. \(\overline{x}_{m}^{d,n}\) is the mean value of data at same time slices within D days, where the data are grouped by link-ID before computing. The size of \(\overline{x}_{m}^{d,n}\) is same as the original traffic flow tensor, and the data at the same time slice in the different day are equal. Due to inevitably missing data, it is possible that a situation emerges where missing data appears continuously for several days. In this case, the \"day-hour trend\" features and the \"hour-minute trend\" features cannot be calculated. We can predict these features that cannot be calculated by means of regression or interpolation. According to the experimental data distribution, this paper adopts linear regression to predict the \"day-hour trend\" features that cannot be calculated, which is as following:  
\[\overline{x}_{\varnothing_{h}}^{d,n}=Linear\ Regression(\overline{x}_{h}^{d,n}) \tag{11}\]  
where \(\overline{x}_{\varnothing_{h}}^{d,n}\) represents the \"day-hour trend\" features that cannot be calculated, while \(\overline{x}_{h}^{d,n}\) represents the \"day-hour trend\" features that can be calculated by Equation (9). Set \(\overline{x}_{h}^{d,n}=\overline{x}_{h}^{d,n}\cup\overline{x}_{\varnothing_{h}} ^{d,n}\) when we have predicted \(\overline{x}_{\varnothing_{h}}^{d,n}\).