# A Hybrid Method for Traffic State Classification Using K-Medoids Clustering and Self-Tuning Spectral Clustering

^{*}

## Abstract

**:**

## 1. Introduction

- The k-medoids algorithm and self-tuning spectral clustering algorithm were combined for traffic state classification in the target area. The k-medoids algorithm was used to divide different sections into multiple clusters based on daily traffic speed data, and then the cluster-center detection points were selected to classify the traffic state using the self-tuning spectral clustering algorithm based on traffic parameters. This process included for the first time the application of the k-medoids algorithm for classification of different sections.
- The first use of the self-adjusting spectral clustering algorithm for traffic state discrimination based on traffic parameters.

## 2. Materials and Methods

#### 2.1. Definition of Traffic State Classification Levels

#### 2.2. Traffic State Classification Index

#### 2.3. K-Medoids Method

- (1)
- Randomly select k data points from the dataset as the center points.
- (2)
- Calculate the distance between each data point and the center point, divide the data point and the nearest center point into one class, and finally divide all data points into k clusters.
- (3)
- Calculate the distance between all data points in each cluster, and select the point with the smallest sum of distances as a new medoid to calculate the cost function generated by the new medoids. If it is negative, replace it, or if not then replace and restore the center point.
- (4)
- Repeat steps (2) and (3) until medoids no longer change, or reach the set number of iterations.

#### 2.4. Self-Tuning Spectral Clustering Method

#### 2.5. The Proposed Method

- (1)
- In this study, a total of 27 loop detectors in a region of California were selected from the Performance Measurement System (PeMS) public database, and the speed data with 1 h interval were extracted for the working day.
- (2)
- The k-medoids clustering algorithm was used to cluster the velocity data for different detection points, and the detection points were divided into different partitions according to the clustering results.
- (3)
- We identified the congestion categories in the evening peak period, and then prepared to further analyze the speed, flow, and occupancy data for 20 working days from the cluster-center detection point.
- (4)
- According to the road transport manual standards, the traffic state was divided into three categories according to the level of road service. The standards of different traffic states were formulated based on the occupancy data, as a reference for determining the accuracy of the clustering results.
- (5)
- The extracted traffic data were clustered by spectral adaptive clustering algorithm, and the classification accuracy, confusion matrix, and NMI values were obtained by combining the definitions of traffic state classification levels.

## 3. Results

#### 3.1. Data Description

#### 3.2. Analysis for Clusters

#### 3.2.1. Analysis of Congested Road Sections Based on Daily Traffic Speed Data at Detection Points

#### 3.2.2. Traffic State Classification Based on Traffic Flow Parameters

#### 3.3. Method Comparison

#### 3.3.1. Comparison of the Classification Accuracy

#### 3.3.2. Normalized Mutual Information (NMI)

## 4. Discussion

## 5. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Wang, M.; Debbage, N. Urban morphology and traffic congestion: Longitudinal evidence from US cities. J. Comput. Environ. Urban Syst.
**2021**, 89, 101676. [Google Scholar] [CrossRef] - Xu, X.; Liu, Y.; Wang, W. ITS-frame: A framework for multi-aspect analysis in the field of intelligent transportation systems. J. IEEE Trans. Intell. Transp. Syst.
**2018**, 20, 2893–2902. [Google Scholar] [CrossRef] - Kaffash, S.; Nguyen, A.T.; Zhu, J. Big data algorithms and applications in intelligent transportation system: A review and bibliometric analysis. J. Int. J. Prod. Econ.
**2021**, 231, 107868. [Google Scholar] [CrossRef] - Nama, M.; Nath, A.; Bechra, N. Machine learning-based traffic scheduling techniques for intelligent transportation system: Opportunities and challenges. J. Int. J. Commun. Syst.
**2021**, 34, e4814. [Google Scholar] [CrossRef] - Wang, W.X.; Guo, R.J.; Yu, J. Research on road traffic congestion index based on comprehensive parameters: Taking Dalian city as an example. J. Adv. Mech. Eng.
**2018**, 10, 1687814018781482. [Google Scholar] [CrossRef] - Ma, M.; Liang, S.; Guo, H. Short-term traffic flow prediction using a self-adaptive two-dimensional forecasting method. J. Adv. Mech. Eng.
**2017**, 9, 1687814017719002. [Google Scholar] [CrossRef] - Nguyen, T.T.; Krishnakumari, P.; Calvert, S.C. Feature extraction and clustering analysis of highway congestion. J. Transp. Res. Part C Emerg. Technol.
**2019**, 100, 238–258. [Google Scholar] [CrossRef] - Tišljarić, L.; Carić, T.; Abramović, B. Traffic state estimation and classification on citywide scale using speed transition matrices. J. Sustain.
**2020**, 12, 7278. [Google Scholar] [CrossRef] - Pei, Y.; Cai, X.; Li, J. Method for Identifying the Traffic Congestion Situation of the Main Road in Cold-Climate Cities Based on the Clustering Analysis Algorithm. J. Sustain.
**2021**, 13, 9741. [Google Scholar] [CrossRef] - Herman, R.; Prigogine, I. A two-fluid approach to town traffic. Science
**1979**, 204, 148–151. [Google Scholar] [CrossRef] - Kerner, B.S. Three-phase traffic theory and highway capacity. J. Phys. A Stat. Mech. Its Appl.
**2004**, 333, 379–440. [Google Scholar] [CrossRef] - Esfahani, R.K.; Shahbazi, F.; Akbarzadeh, M. Three-phase classification of an uninterrupted traffic flow: A k-means clustering study. J. Transp. B Transp. Dyn.
**2019**, 7, 546–558. [Google Scholar] [CrossRef] - Wang, Z.; Chu, R.; Zhang, M. An Improved Selective Ensemble Learning Method for Highway Traffic Flow State Identification. J. IEEE Access
**2020**, 8, 212623–212634. [Google Scholar] [CrossRef] - Cheng, Z.; Wang, W.; Lu, J. Classifying the traffic state of urban expressways: A machine-learning approach. J. Transp. Res. Part A Policy Pract.
**2020**, 137, 411–428. [Google Scholar] [CrossRef] - Lloyd, S. Least squares quantization in PCM. J. IEEE Trans. Inf. Theory
**1982**, 28, 129–137. [Google Scholar] [CrossRef] - Montazeri-Gh, M.; Fotouhi, A. Traffic condition recognition using the k-means clustering method. J. Sci. Iran.
**2011**, 18, 930–937. [Google Scholar] [CrossRef] - Rao, W.; Xia, J.; Lyu, W. Interval data-based k-means clustering method for traffic state identification at urban intersections. J. IET Intell. Transp. Syst.
**2019**, 13, 1106–1115. [Google Scholar] [CrossRef] - Zhao, S.; Xiao, Y.; Ning, Y.; Zhou, Y.; Zhang, D. An optimized K-means clustering for improving accuracy in traffic classification. Wirel. Pers. Commun.
**2021**, 120, 81–93. [Google Scholar] [CrossRef] - Liu, J.; Wang, X.; Li, Y.; Kang, X.; Gao, L. Method of Evaluating and Predicting Traffic State of Highway Network Based on Deep Learning. J. Adv. Transp.
**2021**, 2021, 8878494. [Google Scholar] [CrossRef] - Yang, S.; Wu, J.; Qi, G.; Tian, K. Analysis of traffic state variation patterns for urban road network based on spectral clustering. Adv. Mech. Eng.
**2017**, 9, 1687814017723790. [Google Scholar] [CrossRef] - Zhang, T.; Xia, Y.; Zhu, Q. Mining related information of traffic flows on lanes by k-medoids. In Proceedings of the 2014 11th International Conference on Fuzzy Systems and Knowledge Discovery (FSKD), Xiamen, China, 19–21 August 2014; pp. 390–396. [Google Scholar]
- Zhang, L.; Jia, Y.; Sun, D.; Yang, Y. A fuzzy weighted c-means classification method for traffic flow state division. Mod. Phys. Lett. B
**2021**, 35, 2150341. [Google Scholar] [CrossRef] - Su, M.T.; Zheng, J.; Zhang, Z.P. Clustering Mining of Urban Traffic Flow Based on CVAE. J. Traffic Logist. Eng.
**2020**, 8, 34–44. [Google Scholar] [CrossRef] - Mondal, M.A.; Rehena, Z. Identifying traffic congestion pattern using k-means clustering technique. In Proceedings of the 2019 4th International Conference on Internet of Things: Smart Innovation and Usages (IoT-SIU), Ghaziabad, India, 18–19 April 2019; pp. 1–5. [Google Scholar]
- Zelnik-Manor, L.; Perona, P. Self-tuning spectral clustering. Adv. Neural Inf. Process. Syst.
**2004**, 17. Available online: https://proceedings.neurips.cc/paper/2004/file/40173ea48d9567f1f393b20c855bb40b-Paper.pdf (accessed on 30 July 2022). - Shang, Q.; Lin, C.Y.; Yang, Z.S.; Bing, Q.C.; Tian, X.J.; Wang, S.X. Traffic state identification for urban expressway based on spectral clustering and RS-KNN. J. South China Univ. Technol.
**2017**, 45, 52–58. [Google Scholar] - Manual, H.C. HCM2010; Transportation Research Board; National Research Council: Washington, DC, USA, 2010; p. 1207.

**Figure 5.**Clustering results for the k-medoids algorithm and clustering centers of each cluster: (

**a**) Cluster 1; (

**b**) Cluster 2; (

**c**) Cluster 3; (

**d**) location of detectors belonging to different clusters in regional road networks.

**Figure 7.**Confusion matrix for accuracy comparison of each method: (

**a**) Self-tuning spectral clustering method (NO.VDS-1117718); (

**b**) self-tuning spectral clustering method (NO. VDS-1115542); (

**c**) K-means method (NO. VDS-1117718); (

**d**) spectral clustering method (NO. VDS-1117718); (

**e**) traditional FCM method (NO. VDS-1117718).

**Figure 9.**Comparison of the overall classification accuracy, average user accuracy, and average producer accuracy of different methods.

Service Level of Road Section | A | B | C | D | E | F |

Traffic states | smooth | slow | congested | |||

Occupancy (%) | <2.8 | 2.8–4.4 | 4.4–6.4 | 6.4–8.8 | 8.8–11.2 | >11.2 |

Traffic States | Flow (Veh/5 min) | Speed (mph) | Occupancy (%) |
---|---|---|---|

smooth | 44.1 | 67.45 | 0.98 |

slow | 259.98 | 65.99 | 5.78 |

congested | 472.08 | 47.50 | 19.64 |

Traffic States | User Accuracy (%) | Producer Accuracy (%) |
---|---|---|

smooth | 100 | 94 |

slow | 96.3 | 93.8 |

congested | 89.8 | 99.7 |

**Table 4.**Congestion state cluster-center data for different detectors (self-tuning spectral clustering method).

Detector | Flow (Veh/5 min) | Speed (Mph) | Occupancy (%) |
---|---|---|---|

No. VDS-1115542 | 467.66 | 62.58 | 10.50 |

No. VDS-1117718 | 472.08 | 47.50 | 19.64 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Shang, Q.; Yu, Y.; Xie, T.
A Hybrid Method for Traffic State Classification Using K-Medoids Clustering and Self-Tuning Spectral Clustering. *Sustainability* **2022**, *14*, 11068.
https://doi.org/10.3390/su141711068

**AMA Style**

Shang Q, Yu Y, Xie T.
A Hybrid Method for Traffic State Classification Using K-Medoids Clustering and Self-Tuning Spectral Clustering. *Sustainability*. 2022; 14(17):11068.
https://doi.org/10.3390/su141711068

**Chicago/Turabian Style**

Shang, Qiang, Yang Yu, and Tian Xie.
2022. "A Hybrid Method for Traffic State Classification Using K-Medoids Clustering and Self-Tuning Spectral Clustering" *Sustainability* 14, no. 17: 11068.
https://doi.org/10.3390/su141711068