## 4 Optimization of the DBN Prediction Model
### Optimization by Firefly Algorithm (FFA)  
This section clarifies the structure of the DBN parameter' optimization utilizing the FFA. The quantity of layers, the quantity of units within each layer, and the rate of learning of the DBN should be chosen to accurately model volume traffic flow prediction. The FFA is a nature-inspired optimization method based on the social mating behaviour of fireflies [43]. This algorithm belongs to the class of swarm intelligence techniques that is based on the bioluminescence flashing behaviour of fireflies, which acts as a signaling system to attract other fireflies and was developed by [PERSON] [44]. In this algorithm each firefly can flash with some degree of brightness. This light can be attractive for other neighboring fireflies and their attraction is influenced by the distance between fireflies. Two fireflies which are close together will a have higher attraction to each other. Each firefly symbolizes a point in a search space and the objective function is denoted by the attractiveness degree of each firefly. The fireflies should move towards their neighbours with the highest attraction. There are two essential parts to FFA: the difference of light intensity, and the definition of their engaging quality. It is considered that the attraction of each firefly is measured by its light intensity. The measurement is related to the encoded objective function. Note that the light intensity \(L(d)\) differs with the distance \(d\), based on Equation (3):  
\[L=L_{0}e^{-\gamma^{d^{2}}} \tag{3}\]  
where intensity of light and value of the absorption coefficient are displayed by \(L_{0}\) and \(\gamma\) separately. As a firefly's attractive quality corresponds to the light intensity realized through neighboring fireflies. Then, we would be able to characterize the attraction \(\beta\) of a firefly as being:  
\[\beta=\beta_{0}e^{-\gamma^{d^{2}}} \tag{4}\]  
where \(\beta_{0}\) is the attraction at \(d=0\). The distance among any two fireflies \(i\) and \(j\) at \(X_{i}\) and \(X_{j}\) can be the Cartesian distance \(d_{ij}=\|X_{i}-X_{j}\|^{2}\) or the 2-norm. If a firefly \(i\) is attracted to another brighter firefly \(j\) and firefly \(i\) is moving towards \(j\), then the movement of a firefly \(i\) can be measured by following equation:  
\[X_{i}=X_{i}+\beta_{0}e^{-\gamma^{d^{2}}}\left(X_{j}-X_{i}\right)+\alpha\varepsilon _{i} \tag{5}\]  
where the second term will also contribute to the intensity of attraction and the third term comes from a Gaussian distribution which is presented by the vector of random variables \(\varepsilon_{i}\). We utilized the FFA to choose the best number of units per layer of RBM, assuming the prediction model is using two stacked RBMs as shown in Figure 4. The visible and hidden layers of the first RBM have \(n\) and \(m\) units respectively. The visible layer of the first RBM is similar to the visible layer of the second RBM. The hidden layer of the second RBM has 1 unit that is the output of the prediction model. Given the rate of learning of RBM is denoted \(\varepsilon\), a firefly is intended to be represented as a vector \(X_{i}\) denoted as a three-dimension vector \(X(n;m;\varepsilon)\), where \(n=1,2,\ldots,n\); and \(m=1,2,\ldots,m\); and \(\varepsilon\in\) (0,1). Using a population of fireflies with size \(P\), the FFA algorithm can be used to improved prediction performance of DBN [13]. The FFA adopted to choose the ideal number of input and hidden units of DBN. The FFA is outlined as follows in Algorithm 1.