Sto usando K-means per raggruppare i miei dati e stavo cercando un modo per suggerire un numero di cluster "ottimale". Le statistiche sui gap sembrano essere un modo comune per trovare un buon numero di cluster.
Per qualche motivo restituisce 1 come numero di cluster ottimale, ma quando guardo i dati è ovvio che ci sono 2 cluster:
Ecco come chiamo gap in R:
gap <- clusGap(data, FUN=kmeans, K.max=10, B=500)
with(gap, maxSE(Tab[,"gap"], Tab[,"SE.sim"], method="firstSEmax"))
Il set di risultati:
> Number of clusters (method 'firstSEmax', SE.factor=1): 1
logW E.logW gap SE.sim
[1,] 5.185578 5.085414 -0.1001632148 0.1102734
[2,] 4.438812 4.342562 -0.0962498606 0.1141643
[3,] 3.924028 3.884438 -0.0395891064 0.1231152
[4,] 3.564816 3.563931 -0.0008853886 0.1387907
[5,] 3.356504 3.327964 -0.0285393917 0.1486991
[6,] 3.245393 3.119016 -0.1263766015 0.1544081
[7,] 3.015978 2.914607 -0.1013708665 0.1815997
[8,] 2.812211 2.734495 -0.0777154881 0.1741944
[9,] 2.672545 2.561590 -0.1109558011 0.1775476
[10,] 2.656857 2.403220 -0.2536369287 0.1945162
Sto facendo qualcosa di sbagliato o qualcuno conosce un modo migliore per ottenere un buon numero di cluster?