Я использую matplotlib для построения иерархических кластеров,
import numpy as np
from scipy.cluster.hierarchy import dendrogram
def plot_dendrogram(model, **kwargs):
# Children of hierarchical clustering
children = model.children_
# Distances between each pair of children
# Since we don't have this information, we can use a uniform one for plotting
distance = np.arange(children.shape[0])
# The number of observations contained in each cluster level
no_of_observations = np.arange(2, children.shape[0]+2)
# Create linkage matrix and then plot the dendrogram
linkage_matrix = np.column_stack([children, distance, no_of_observations]).astype(float)
# Plot the corresponding dendrogram
dendrogram(linkage_matrix, **kwargs)
plt.figure(figsize=(100,100))
plt.title('Hierarchical Clustering Dendrogram')
plot_dendrogram(clustering, labels=liste_tags)
plt.show()
Я могу визуализировать иерархическую кластеризацию, однако качество и разрешение графика не очень хорошее.Особенно, когда я сохраняю график и пытаюсь увеличить изображение, чтобы увидеть надписи, например.
Я получаю это изображение: ![enter image description here](https://i.stack.imgur.com/lLkJ4.png)