import numpy as np
from sklearn import datasets
import matplotlib.pyplot as plt
from finch import FINCH
n_samples = 5000
n_clusters = 5
random_state = 42
X, y = datasets.make_blobs(n_samples=n_samples, centers=n_clusters, random_state=random_state)
fin = FINCH()
fin.fit(X)
print(fin.partitions)
我想从 FINCH 算法中打印分区和每个分区中的簇数。但是,我不断收到此错误:
TypeError: FINCH() missing 1 required positional argument: 'data'
FINCH 类的可选参数有:
metric(默认='euclidean'):使用的距离度量
n_jobs (default=1): 启动的进程数 -1 表示使用所有处理器
我不知道为什么类调用需要“数据”值。
尝试此 GitHub 中的这段示例代码https://github.com/eren-ck/finch/blob/main/demo/demo.ipynb
有两个看起来相似的雀类库:
看起来您已经安装了需要
data参数的
finch-clust
。但使用代码finchpy
。
尝试:
pip uninstall finch-clust
pip install finchpy