<jupyter_start><jupyter_text>---<jupyter_code>X = np.random.randint(0,30,90).reshape(30,3).astype('float')
X[10,:]
km = Kmeans(random_state=33, init='forgy')
km.fit(X)
km.centroid_init_
km.centroid_loc_
km.predict(X)
km.count_
km.inertia_
km.silhouette_<jupyter_output><empty_output><jupyter_text>---<jupyter_code>km2 = Kmeans(random_state=33, init='k++')
km2.fit(X)
km2.centroid_init_
km2.centroid_loc_
km2.predict(X)
km2.count_
km2.inertia_
km2.silhouette_<jupyter_output><empty_output><jupyter_text>---<jupyter_code>from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=2, init='k-means++')
kmeans.fit(X)
kmeans.cluster_centers_
kmeans.predict(X)
kmeans.n_iter_
kmeans.inertia_
silhouette_score(X, kmeans.predict(X))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16116248348745046, 'fraction_numerical': 0.03038309114927345, 'mean_word_length': 9.243243243243244, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '652619', 'license': 'MIT', 'n_tokens_mistral': 370, 'n_tokens_neox': 352, 'n_words': 35, 'path': 'notebooks/K-means.ipynb', 'repo_name': 'ashishpatel26/ML_From_Scratch', 'size': '757'}