<jupyter_start><jupyter_text>Again, 5 clusters is not a bad choice.<jupyter_code># Fitting Hierarchical Clustering to the dataset
from sklearn.cluster import AgglomerativeClustering
hc = AgglomerativeClustering(n_clusters=5, affinity='euclidean', linkage='ward')
y_hc = hc.fit_predict(X)
# Visualising the clusters
plt.scatter(X[:, 0], X[:, 1], c=y_hc, edgecolors='black')
plt.title('Clusters of customers')
plt.xlabel('Annual Income (k$)')
plt.ylabel('Spending Score (1-100)')
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14092664092664092, 'fraction_numerical': 0.015444015444015444, 'mean_word_length': 8.436363636363636, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '281825', 'license': 'MIT', 'n_tokens_mistral': 204, 'n_tokens_neox': 184, 'n_words': 43, 'path': 'Part 4 - Clustering/Section 25 - Hierarchical Clustering/Hierarchical Clustering.ipynb', 'repo_name': 'onnoeberhard/machine-learning-az', 'size': '518'}