I have a one dimension weather temperature data and I need to split into 7 clusters(maybe less). Temperature data in the very low end and high end is not as common as middle range values. So using kmeans might violate its assumption that each cluster need to be relative equal sized. But hierarchy clustering dose not give a good clustering result in this case. I still tried kmeans. The results seems relative random, how decide which result is better than the other?
#use the default value,converged after 2 runs
y_3<-kmeans(y,7)
(between_SS / total_SS = 95.6 %)
cluster centers size
2 52.50034 37
1 57.12902 122
6 60.65326 238
7 64.25651 270
5 67.89233 241
4 72.29133 154
3 78.10350 78
#try to increase the iteration but it converged after 2 runs
y_4 = kmeans(y,centers =7, iter.max = 1000)
(between_SS / total_SS = 95.9 %)
cluster centers size
1 54.72145 97
3 59.56208 226
5 63.10763 249
6 66.42057 241
4 70.04897 176
2 74.32394 104
7 79.47868 47
#tried to increase iteration, also set the initial randomized set as 10 , converged after 3 runs
y_6 = kmeans(y,centers =7, nstart=10, iter.max = 100)
(between_SS / total_SS = 95.9 %)
cluster centers size
3 54.72145 97
5 59.56993 227
7 63.13466 251
4 66.46375 241
1 70.10488 175
2 74.53701 109
6 79.90417 40