# An Intelligent Time-Series Model for Forecasting Bus Passengers Based on Smartcard Data
## 3 Proposed Model
In addition, the four intelligent forecast methods (MLP, SVR, RBF network, and LSTM) were separated into 10 models according to the hidden layer, activation function, and kernel functions, as shown in Table 4.  
The proposed model is based on the concept of adaptive expectation theory [40,41] to adapt the forecast data of the top three of the 80 combined forecast models (10 intelligent forecast models with 8 different lag periods, as shown in Table 5). The equation used in the proposed model is as follows. \[F(t)=\alpha\times\textit{first}(t)+\beta\times\textit{second}(t)+\gamma\times \textit{third}(t)+T(t-1) \tag{1}\]  
where  
\(F(t)\) is the forecast of the number of passengers at time \(t\),  
\(T(t-1)\) denotes the actual number of passengers at time \((t-1)\),  
\(\textit{first}(t)\) represents the forecast of the best model for the number of passengers at time \(t\),  
\(\textit{second}(t)\) is the forecast of the second-best model for the number of passengers at time \(t\),  
\(\textit{third}(t)\) denotes the forecast of the third-best model for the number of passengers at time \(t\),  
\(\alpha\) is the parameter of \(\textit{first}(t)\),  
\(\beta\) represents the parameter of \(\textit{second}(t)\),  
\(\gamma\) denotes the parameter of \(\textit{third}(t)\), and the range of \(\alpha\), \(\beta\), and \(\gamma\) is from \(-1\) to \(1\) (\(-1\) means a negative correlation, and \(1\) represents a positive correlation). \begin{table}
\begin{tabular}{l l} \hline \hline
**Model Abbreviation** & **Full Name** \\ \hline MLP\_1\_lin & MLP with 1 hidden layer and linear activation function \\ MLP\_1\_log & MLP with 1 hidden layer and logistic activation function \\ MLP\_2\_lin & MLP with 2 hidden layer and linear activation function \\ MLP\_2\_log & MLP with 2 hidden layer and logistic activation function \\ SVM\_lin & SVR with linear kernel function \\ SVM\_pol & SVR with polynomial kernel function \\ SVM\_rbf & SVR with RBF kernel function \\ SVM\_sig & SVR with sigmoid kernel function \\ RBF net & Radial basis function network \\ LSTM & Long short-term memory \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Abbreviation of ten intelligent forecast models. \begin{table}
\begin{tabular}{l l l} \hline \hline  & **Week (Seven Days)** & **Weekday** & **Holiday** \\ \hline Route 1 & Lag: 1, 2, 4, 6, 7 & Lag:1, 2, 4, 5 & Lag:1 \\ Route 7 & Lag: 1, 2, 3, 4, 7 & Lag:1, 3, 4, 5, 6 & Lag:1, 2 \\ Route 52 & Lag: 1, 2, 3, 4, 6, 7 & Lag:1, 2, 3, 4, 5 & Lag:1, 2 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Number of lag periods for each route in different time data. To optimize the parameters for \(\alpha\), \(\beta\), and \(\gamma\), the top three forecasted data points were used to adapt these parameters based on the minimum root mean square error (RMSE) and average absolute percentage error (MAPE) by using Equation (1). First, we set a feasible step iteration (step = 0.001) to produce the best parameters for \(\alpha\), \(\beta\), and \(\gamma\). Because the right-hand side of equation (1) has the actual number of passengers at the previous time \(t-1\), the parameters of the first three forecast data points would fall between plus and minus one. Step 5: Evaluation and comparison  
In order to evaluate the proposed model and compare it with the listed models, in this step, the minimum RMSE and MAPE criteria were used for the evaluation and comparison. In terms of data, the data from three routes with three different types of days were compared experimentally based on an 8:2 ratio of training and testing data with time order. The data collected for each route were as follows: weekly data 669 = 535 training data + 134 testing data; weekday data 455 = 364 training data + 91 testing data; weekend data 214 = 171 training data + 23 testing data. The performance indicators used were the root mean square error (RMSE) and average absolute percentage error (MAPE). The equations are shown as Equations (2) and (3).