Commit 6d69d04b authored by Elias's avatar Elias

Tool: Internal metrics plots

parent b1ba5891
......@@ -87,3 +87,9 @@ python3 hierarchiqueAvecDerniereDistance.py \
```bash
python3 count_nb_segments.py /path/to/your/segments
```
### • Internal metrics plots (wcss, silhouette and davies-bouldin)
```bash
python3 internal_metrics_in_graphical_form.py
```
import matplotlib.pyplot as plt
# Données
k = [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650]
wcss = [7011484.50, 6806317.50, 6659663.00, 6556700.50, 6464688.50, 6391583.00, 6328672.50, 6281429.00, 6216793.50, 6178428.00, 6137612.00, 6107232.50]
silhouette = [-0.0106, -0.0147, -0.0243, -0.0299, -0.0370, -0.0406, -0.0459, -0.0427, -0.0562, -0.0531, -0.0522, -0.0666]
davies = [4.6826, 4.6141, 4.4273, 4.3083, 4.2020, 4.1403, 4.1319, 4.0021, 3.9148, 3.8587, 3.8543, 3.7699]
plt.figure(figsize=(14, 5))
# WCSS
plt.subplot(1, 3, 1)
plt.plot(k, wcss, marker='o')
plt.title("WCSS vs k")
plt.xlabel("Nombre de clusters (k)")
plt.ylabel("WCSS")
plt.grid(True)
# Silhouette
plt.subplot(1, 3, 2)
plt.plot(k, silhouette, marker='o', color='orange')
plt.title("Silhouette vs k")
plt.xlabel("Nombre de clusters (k)")
plt.ylabel("Score silhouette")
plt.grid(True)
# Davies-Bouldin
plt.subplot(1, 3, 3)
plt.plot(k, davies, marker='o', color='green')
plt.title("Davies-Bouldin vs k")
plt.xlabel("Nombre de clusters (k)")
plt.ylabel("Indice Davies-Bouldin")
plt.grid(True)
plt.tight_layout()
plt.show()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment