python - 使用 metrics.adjusted_rand_score 获取链接的性能
问题描述
大家好,我有下面的代码,我想知道如何通过使用 metrics.adjusted_rand_score 方法来获得链接的性能。
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from scipy.cluster.hierarchy import dendrogram, linkage
from sklearn.cluster import AgglomerativeClustering
Y = np.array([[1],[7],[15],[12], [2], [4], [7], [8], [10], [15],[17], [21]])
cluster = AgglomerativeClustering(n_clusters=4)
cluster.fit(Y)
cluster.labels_
linked = linkage(Y, 'ward')
labelList = [[1],[7],[15],[12], [2], [4], [7], [8], [10], [15],[17], [21]]
plt.figure(figsize=(10, 7))
dendrogram(linked,orientation='top',labels=labelList,distance_sort='descending',show_leaf_counts=True)
plt.show()
顺便说一句,我还想知道我应该如何将它与 Means 一起使用。
先感谢您。
解决方案
推荐阅读
- javascript - 为 webworkers 中的 importscripts 指定字符集
- excel - 如何找出从 A 列到 B 列的匹配值?
- python - 如何在 pandas 中按 3 列分组并从日期列中给出的第一个条目开始计算其每年的频率
- python - TypeError:send() 接受 1 到 2 个位置参数,但给出了 3 个 discord.py
- algorithm - 我们如何计算前缀范围更新的加权累积平方和加一?
- java - rx-java IO Scheduler 是否维护顺序?
- c# - c#中的AES GCM加密/解密与BouncyCastle
- sql - 如何获取上个月的数据以显示每一天?
- html - 如何在 CSS 中创建双偏移边框
- docker-compose - Terraform:在 EKS/ECS 上部署 Docker Compose 应用程序