# Accelerometer-Based Pavement Classification for Vehicle Dynamics Analysis Using Neural Networks
## 2 Materials and Methods
### Accuracy Matrices  
The basic terminology and coefficients describing the quality of the classifier are presented below [37; 46]. For each class, we defined a confusion matrix. For the \(j\)-th class, we defined the membership of this class as a positive case and we took the membership of the other classes as a negative case. The confusion matrix presented in Table 1 contains the following values:  
TP (True Positive) denotes the number of cases for which membership of the \(j\)-th class is correctly identified,  
TN (True Negative)--the number of cases for which membership of other classes was correctly recognized,  
FP (False Positive)--the number of cases for which a signal belonging to other classes was recognized as a signal of the \(j\)-th class,  
FN (False Negative)--the number of cases for which a signal originating from class \(j\)-th was recognized as a signal belonging to the other classes. Below, we use the following basic characteristics to describe the quality of the classifier:  
Accuracy denotes the part of samples which were correctly identified:  
\[Accuracy=\frac{TP+TN}{TP+TN+FP+FN}. \tag{18}\]  
The true positive rate is the proportion of cases belonging to the \(j\)-th class that are correctly recognized by the model:  
\[\text{{True Positive Rate}}(TPR)=\text{{Sensitivity}}=\frac{TP}{TP+FN}. \tag{19}\]  
Specificity is the proportion of cases not belonging to the \(j\)-th class that are correctly classified by the model:  
\[\text{{Specificity}}=1-\text{{False Positive Rate}}(FPR)=\frac{TN}{TN+FP}. \tag{20}\] \begin{table}
\begin{tabular}{c c c} \hline \hline  & **Predicted Positive** & **Predicted Negative** \\ \hline Positive & TP & FN \\ Negative & FP & TN \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Confusion matrix for classifier performance evaluation. The Positive Predicted Value is the proportion of cases belonging to the \(j\)-th class among those predicted by the model as belonging to the \(j\)-th class:  
\[\textit{Positive Predicted Value}(PPV)=\textit{Precision}=\frac{TP}{TP+FP}\, \tag{21}\]  
The Negative Predicted Value is the proportion of cases not belonging to the \(j\)-th class among those predicted by the model as not belonging to the \(j\)-th class:  
\[\textit{Negative Predicted Value}(\textit{NPV})=\frac{TN}{TN+FN}\, \tag{22}\]  
Prevalence is the proportion of samples belonging to the \(j\)-th class:  
\[\textit{Prevalence}=\frac{TP+FN}{TP+TN+FP+FN}\, \tag{23}\]  
The Detection rate is the proportion of samples that are correctly classified by the model as belonging to the \(j\)-th class:  
\[\textit{Detection Rate}=\frac{TP}{TP+TN+FP+FN}, \tag{24}\]  
Detection prevalence is the proportion of samples that are classified by the model as belonging to the \(j\)-th class:  
\[\textit{Detection Prevalence}=\frac{TP+FP}{TP+TN+FP+FN} \tag{25}\]  
Balanced accuracy is a mean between sensitivity and specificity:  
\[\textit{Balanced Accuracy}=\frac{\textit{Sensitivity}+Specificity}{2} \tag{26}\]  
The False Alarm Rate is the proportion of cases misclassified by the model as belonging to the \(j\)-th class:  
\[\textit{False Alarm Rate}=\frac{FP}{TP+FP} \tag{27}\]  
Additionally, a Receiver Operating Characteristic (ROC) curve and Area Under the Curve (AUC) was determined for each class. For this purpose, using the function \(softmax\) for neural networks and using Formula (10) for multinomial logistic regression, we determine the membership probabilities for each class. For the \(j\)-th class (\(j\in\{1,2,\dots,p\}\)) for different cut-off levels (thresholds) \(0\leq c\leq 1\) we determine a confusion matrix, where we score the \(i\)-th case as positively recognized if \(P(Y=j|x_{i})\geq c\) otherwise as negatively recognized for \(1\leq i\leq n\). Based on the confusion matrix, we determine the FPR (\(1-\) Specificity) and the TPR and place the points in the coordinate system. For different thresholds, we determine the confusion matrices and calculate the fraction of positive outcomes of the total positives and the fraction of false positives of the total negatives.