# A Scenario-Adaptive Driving Behavior Prediction Approach to Urban Autonomous Driving
## Materials and Methods
### Learning Quantitative Features
\begin{table}
\begin{tabular}{c c} \hline
**ID** & **SWRL Rules** \\ \hline \multirow{4}{*}{Rule \#1} & _vehicle(\(\mathcal{V}\)) \(\wedge\) distanceToJunction(\(\mathcal{I}\)), close \(\wedge\) hasTrafficLight(\(\mathcal{I}\)), \(\mathcal{T}\)TL) \(\wedge\) hasState(\(\mathcal{T}\)TL, green) \(\wedge\) onRoadSegment(\(\mathcal{V}\),?Seg) \(\wedge\) connectToSidewalk(\(\mathcal{Seg}\),?SW) \(\wedge\) hasObstacle(\(\mathcal{S}\)SW,?P) \(\wedge\) hasSpeed(?P, low) \(\wedge\) hasDirection(?P,?Vertical)_ \\ \cline{2-3}  & \(\rightarrow\)result(?V,\" M[LK, TR, TL, SS], F[TTI, \(\upsilon_{lon}\), \(\upsilon_{lat}\)], P[0.10, 0.30, 0.30, 0.30])\({}^{\prime}\)) \\ \hline \multirow{4}{*}{Rule \#2} & _vehicle(\(\mathcal{V}\)) \(\wedge\) distanceToJunction(\(\mathcal{I}\)), far) \(\wedge\) hasSpeed(?V, medium) \(\wedge\) hasTargetFront(\(\mathcal{V}\),?V\({}_{F}\))\(\wedge\) hasSpeed(?V, rervslov) \(\wedge\) hasRightFront(\(\mathcal{V}\),?V\({}_{RF}\)) \(\wedge\) hasSpeed(?V\({}_{RF}\), fast) \(\wedge\) hasRightRear(\(\mathcal{V}\),?V\({}_{RR}\)) \(\wedge\) hasSpeed(?V\({}_{RR}\), slow) \(\wedge\) distanceToTarget(\(\mathcal{V}\), rloc) \(\wedge\)relativeSpeed(?V\({}_{RR}\), fast)_ \\ \cline{2-3}  & \(\rightarrow\)result(?V,\" M[LK,LCL,LCR], F[d\({}_{diff-lane}\), \(\upsilon_{lat}\)], P[0.10, 0.45, 0.45]\({}^{\prime}\)) \\ \hline \multirow{4}{*}{Rule \#3} & _vehicle(\(\mathcal{V}\)) \(\wedge\) distanceToJunction(\(\mathcal{I}\)), close) \(\wedge\) hasSpeed(?V, fast) \(\wedge\) hasTargetFront(?V,?V\({}_{F}\)) \(\wedge\) onRoadSegment(?V,?SegI) \(\wedge\) connectToJunction(?SegI,?) \(\wedge\) connectToSidewalk(?SegI,?SW) \(\wedge\) hasObstacle(?SW, null) \(\wedge\) hasConnectionRestriction(?I,?CR) \(\wedge\) IndividualOf(\(\mathcal{C}\)CR,?X) \(\wedge\) differentFrom(?X,Left) \(\wedge\) differentFrom(?X,Right) \(\wedge\) differentFrom(?X,UITurn) \(\wedge\) From(?CR,?SegI) \(\wedge\) To (?CR,?Seg2) \(\wedge\) hasSeed(?V, rervslov)_ \\ \cline{2-3}  & \(\rightarrow\)result(?V,\" M[LK, LCL, LCR ], F[TTI, \(\upsilon_{lon}\), \(d_{diff-lane}\), \(\upsilon_{lat}\)], P[0.40, 0.10, 0.50]\({}^{\prime}\)) \\ \hline... & \\ \hline \end{tabular}
\end{table} 
Table 2: Example rules that have been used in this study. \[e_{i}(\mathrm{O})=\sum_{m=1}^{M}c_{jm}\mathcal{N}\big{(}O\big{|}(\mu_{jm},\sigma_{ jm})\big{)},\;1\leq\mathrm{j}\leq N, \tag{15}\]  
where \(c_{jm}\) is the mixture coefficient for the \(k-\mathrm{th}\) mixture in \(j-\mathrm{th}\) state, and \(\mathcal{N}\) is the pdf of Gaussian distribution with mean \(\mu_{jm}\) and covariance matrix \(\sigma_{jm}\). The mixture gains satisfy the following constraint:  
\[\sum_{m=1}^{M}c_{jm}=1,\;1\leq\mathrm{j}\leq\mathrm{N}, \tag{16}\]  
where \(c_{jm}\geq 0,\;1\leq m\leq C\). \(\mathrm{C}\) is the total number of mixtures. Then the pdf can be normalized by  
\[\int_{-\infty}^{\infty}e_{i}(x)\;dx=1,\;1\leq\mathrm{j}\leq\mathrm{N}. \tag{17}\]  
Based on the aforementioned formulation, the HMM can be determined by \(\lambda(A,E,\Pi,C,\mu,\sigma)\). In this study, field data were collected for different scenarios. The observations for corresponding behaviors were extracted and used to train the HMMs. For each behavior, the K-means algorithm was applied to clustering the training data and estimate the initial distribution of the Gaussian functions. Next, the Baum-Welch algorithm [PERSON] and [PERSON] (1954) was applied to estimate the maximum likelihood HMM parameters, i.e.,  
\[\lambda^{*}(A,E,\Pi,C,\mu,\sigma)=\underset{\lambda}{\mathrm{argmax}}\; \mathrm{P}(\mathrm{O}|\lambda(A,E,\Pi,C,\mu,\sigma)\,). \tag{18}\]  
Then, the HMM \(\lambda^{*}(A,E,\Pi,C,\mu,\sigma)\) was considered as the driving behavior model for this type of behavior.