<jupyter_start><jupyter_text>K-Means Clustering<jupyter_code>from sklearn.preprocessing import StandardScaler
iris = datasets.load_iris()
X = StandardScaler().fit_transform(iris.data)
y = iris.target
from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=3)
model = kmeans.fit(X)
model.predict(X)<jupyter_output><empty_output><jupyter_text>DBSCAN Density Based Spatial Clustering of Applications with Noise<jupyter_code>from sklearn.cluster import DBSCAN
model = DBSCAN().fit(X)
model.labels_
model.get_params()<jupyter_output><empty_output><jupyter_text>Hierarchical Clustering<jupyter_code>from sklearn.cluster import AgglomerativeClustering
hc = AgglomerativeClustering(n_clusters=3)
model = hc.fit(X)
model.labels_
model.get_params()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09948320413436693, 'fraction_numerical': 0.002583979328165375, 'mean_word_length': 10.071428571428571, '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': '85431', 'license': 'MIT', 'n_tokens_mistral': 294, 'n_tokens_neox': 284, 'n_words': 45, 'path': 'Machine Learning Cookbook/Chapter 19 Clustering.ipynb', 'repo_name': 'sonwanesuresh95/Books-to-notebooks', 'size': '774'}