我有两个密集矩阵(title
和para
)。我希望使用亲和传播算法对它们进行聚类,然后绘制聚类。关于两个特征和绘图结果的集群
我已经写了下面的代码,哪些集群基于一个特征。我怎样才能适应这两个功能集群,然后绘制结果?
import os
import time
import string
import pickle
import matplotlib.pyplot as plt
from sklearn.cluster import AffinityPropagation
from sklearn import metrics
import matplotlib.pyplot as plt
from itertools import cycle
#from sklearn.ensemble import RandomForestClassifier
#Opens and stores preprocessed data.
filepath = '...'
with open((filepath + 'para.dat'), 'rb') as infile:
para = pickle.load(infile)
with open(filepath + 'title.dat', 'rb') as infile:
title = pickle.load(infile)
with open(filepath + 'y.dat', 'rb') as infile:
y = pickle.load(infile)
af = AffinityPropagation().fit(para)
cluster_centers_indices = af.cluster_centers_indices_
labels = af.labels_
n_clusters_= len(cluster_centers_indices)
这是我用这为执行聚类,由此整个数据集簇和簇的质心形成产生训练数据集代表的训练数据集的查询的主动学习方法的一部分整个数据集。
已编辑问题以澄清目的。 – user7347576
在这种情况下,它们的权重不相等? – user7347576
他们可能无法比较,所以即使将alpha设置为0.5,他们也不会产生相同的影响。 –