# Accelerometer-Based Pavement Classification for Vehicle Dynamics Analysis Using Neural Networks
## 2 Materials and Methods
### Multinomial Logistic Regression  
Logistic regression [37; 40; 41; 42] is a statistical model that describes the linear dependence of log odds on independent variables.  
Multinomial logistic regression [37; 43] describes the probability distribution of a random variable \(Y\) with respect to the input variable \(x\in\mathbb{R}^{m}\). The probability that the observation \(x\in\mathbb{R}^{m}\) comes from \(j\)-th class:  
\[P(Y=j|x)=\frac{e^{\langle(1,x),\beta_{j}\rangle}}{\sum_{k=1}^{p}e^{\langle(1, x),\beta_{p}\rangle}}, \tag{10}\]  
where \(\beta_{j}=\big{(}\beta_{0j},\beta_{1j},\beta_{2j},...,\beta_{mj}\big{)}\) denotes the parameters of logistic regression for \(j\)-th class, \(j\in 1,2,\ldots,p\).  
When the random variable \(Y\) is encoded as a one-hot-encoding vector, i.e., the \(j\)-th class corresponds the vector \(y=\big{(}y_{1},y_{2},\ldots,y_{p}\big{)}\), where \(y_{j}=1\) and \(y_{i}=0\) for \(i\
eq j\), \(1\leq i\leq p\)), then the probability is as follows:  
\[P(Y)=y|x)=\prod_{j=1}^{p}\Bigg{(}\frac{e^{\langle(1,x),\beta_{j}\rangle}}{\sum _{k=1}^{p}e^{\langle(1,x),\beta_{p}\rangle}}\Bigg{)}^{y_{j}}=\frac{\prod_{j=1} ^{p}\Big{(}e^{\langle(1,x),\beta_{j}\rangle}\Big{)}^{y_{j}}}{\sum_{k=1}^{p}e^ {\langle(1,x),\beta_{p}\rangle}}. \tag{11}\]  
We assume that the observations are drawn randomly. For data set \(D=\{(x_{i},y_{i}):1\leq i\leq n,x_{i}\in\mathbb{R}^{m},y_{i}\in\{0,1\}^{p}\}\), we define the likelihood function \(L(\beta)\) as follows:  
\[L(\beta)=\prod_{i=1}^{n}P(Y=y_{i}|x_{i})=\prod_{i=1}^{n}\prod_{j=1}^{p}\Bigg{(} \frac{e^{\langle(1,x_{i}),\beta_{j}\rangle}}{\sum_{k=1}^{p}e^{\langle(1,x_{i} ),\beta_{p}\rangle}}\Bigg{)}^{y_{j}}, \tag{12}\]  
where \(\beta=\big{(}\beta_{1},\beta_{2},\ldots,\beta_{p}\big{)}\). The identification of multinomial logistic regression consists of the solution the following task:  
\[\underset{\beta}{max}\quad L(\beta), \tag{13}\]  
Instead of solving task (13) we solved the auxiliary task:  
\[\underset{\beta}{max}\quad lnL(\beta), \tag{14}\]  
we estimated \(\beta_{j}\) the unknown parameters of multinomial logistic regression, where from (11) and (12), the logarithm of likelihood function is given by the following formula:  
\[lnL(\beta)=\sum_{i=1}^{n}\Bigg{(}\sum_{j=1}^{p}y_{ij}\langle(1,x_{i}),\beta \rangle-ln\Bigg{(}\sum_{k=1}^{p}e^{\langle(1,x),\beta_{p}\rangle}\Bigg{)} \Bigg{)}. \tag{15}\]When the predictors are correlated, we used regularization [44; 45] to receive better predictions. In the presented case, ELASTICNET was also used. The parameters of multinomial logistic regression are determined by solving the following task:  
\[\underset{\beta}{max}\sum_{i=1}^{n}\left(\sum_{j=1}^{p}y_{ij}((1,x_{i}),\beta)- ln\left(\sum_{k=1}^{p}e^{((1,x),\beta_{p})}\right)\right)-\lambda P_{\alpha}( \beta), \tag{16}\]  
where \(\lambda>0\), \(0\leq\alpha\leq 1\) and \(P_{\alpha}\) denotes the penalty calculated as follows:  
\[P_{\alpha}(\beta)=\alpha\parallel\beta\parallel_{L_{1}}+\frac{1-\alpha}{2} \parallel\beta\parallel_{L_{2}}=\sum_{j=1}^{p}\left(\alpha|\beta_{j}|+\frac{1 -\alpha}{2}\beta_{j}^{2}\right). \tag{17}\]  
After estimating the parameters of multinomial logistic regression, we determined the probabilities of membership to each class by using Formula (11).