Research Article
Road Traffic Safety Risk Estimation Method Based on Vehicle Onboard Diagnostic Data
Algorithm 1
Level threshold optimization algorithm (“⟵” represents value assignment).
(1) | int r ⟵ k-means number of clusters | (2) | For int t = 1 to r − 1 | (3) | int at ⟵ Safety entropy value of the center of the tth cluster | (4) | int bt ⟵ Safety entropy value of the center of the (t + 1)th cluster | (5) | int st ⟵ Sum of the data in the tth and (t + 1)th clusters | (6) | int f = 1 | (7) | For float etf = at to bt | (8) | int ctf ⟵ Volume of data in the tth cluster that is misclassified | (9) | int dtf ⟵ Volume of data in the (t + 1)th cluster that is misclassified | (10) | = 1 − ((ctf + dtf)/st)//Calculation of accuracy | (11) | etf = etf + 0.01 | (12) | Bt (f, 1: 2) = [etf, ]//The threshold and accuracy are stored in the matrix Bt | (13) | f = f + 1 | (14) | End for | (15) | Ct ⟵ Generation of the threshold corresponding to the highest accuracy | (16) | End for | (17) | C = [C1, C2, …, Cr − 1]//A number of thresholds (r − 1) is successively stored in the vector C |
|