Closed Nikronic closed 6 years ago
It was my bad, but it is necessary to assign our own centers data.beacuse of algorithm loop. when we do all steps, centers will be changed because of mutation, variation and ... .so these changed centers must be involved in K-means. def doKmeans(x,clusters_count,init_centers= 'k-means++'): kmeans = KMeans(n_clusters = clusters_count, init = init_centers,n_init = 50) y_predict_kmeans = kmeans.fit_predict(x) return (y_predict_kmeans,kmeans.clustercenters,kmeans.inertia_) This one is now true definition. beacause we are able to give input centers. but for sampling interval, you right it was my fault.
There 2 for loops in code and both first one is unnecessary. but the second one. you should assign centers randomly as Kmeans++ do. But you are assigning centers manually. And you are passing wrong argument to it. passing sampling_intervals which is calculated by sampling_intervals() function to the init_centers