Memuat
Memuat
K-Means Clustering for Civil Engineering and Transportation
0 views
Group road segments based on traffic volume and distress index with K-Means Clustering to uncover group patterns. K-Means partitions data into k clusters by minimising the distance of points to their cluster centres. It suits segmentation of numeric data, such as customers or regions, when the number of clusters can be estimated.

Group road segments based on traffic volume and distress index with K-Means Clustering to uncover group patterns.
| Role | Variable | Unit |
|---|---|---|
| Main | Road segments | - |
| Supporting 1 | Traffic volume | smp/hari |
| Supporting 2 | Distress index | - |
K-Means forms 3 clusters on Road segments, Traffic volume and Distress index with a silhouette of 0.768.
Computed from illustrative synthetic data, not from a real study.
K-Means partitions data into k clusters by minimising the distance of points to their cluster centres. It suits segmentation of numeric data, such as customers or regions, when the number of clusters can be estimated.
Report the reason for choosing k (elbow and silhouette) and describe each cluster in substantive terms. Remind that clusters are exploratory findings, not absolute truth.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import silhouette_score
X, _ = make_blobs(n_samples=400, centers=4, cluster_std=1.0, random_state=15)
X = StandardScaler().fit_transform(X)
traffic_volume = X[:, 0]
distress_index = X[:, 1]
ks = range(2, 9)
inertia, sil = [], []
for k in ks:
km = KMeans(n_clusters=k, n_init=10, random_state=15).fit(X)
inertia.append(km.inertia_)
sil.append(silhouette_score(X, km.labels_))
print("k =", k, "inertia =", round(km.inertia_, 1), "silhouette =", round(sil[-1], 3))
best_k = list(ks)[int(np.argmax(sil))]
road_segments = KMeans(n_clusters=best_k, n_init=10, random_state=15).fit(X)
print("Chosen k:", best_k)
fig, ax = plt.subplots(1, 2, figsize=(10, 4))
ax[0].plot(list(ks), inertia, marker="o"); ax[0].set_xlabel("k"); ax[0].set_ylabel("Inertia")
ax[1].scatter(traffic_volume, distress_index, c=road_segments.labels_, s=15)
ax[1].scatter(*road_segments.cluster_centers_.T, c="r", marker="x", s=80)
plt.tight_layout()
plt.show()Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$19
excl. 11% VAT
Duration: 3 working days
Output: Python files + result figures
Deliverables
Package 2 · most chosen
US$53
excl. 11% VAT
Duration: 7 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$116
excl. 11% VAT
Duration: 12-15 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. K-Means Clustering is commonly used at this level in Civil Engineering and Transportation. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output Python gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$19, Package 2 (your data analysis and interpretation) US$53 and Package 3 (full guidance) US$116, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.
The result sheet uses illustrative synthetic data. Python is a trademark of the Python Software Foundation.
Back to Python portfolio