May 2018
Beginner
490 pages
13h 16m
English
sklearn now does the job using the training dataset and hyperparameters in the following lines of code:
#III.k-means clustering algorithmkmeans = kmeans.fit(dataset) #Computing k-means clustering
The gcenter array contains the geometric centers or centroids and can be printed for verification purposes, as shown in this snippet:
gcenters = kmeans.cluster_centers_print("The geometric centers or centroids:"print(gcenters)'''Ouput of centroid coordinates[[ 48.7986755 85.76688742][ 32.12590799 54.84866828][ 96.06151645 84.57939914][ 68.84578885 55.63226572][ 48.44532803 24.4333996 ][ 21.38965517 15.04597701]]'''
These geometric centers need to be visualized with labels for decision-making purposes.
Read now
Unlock full access