在特征聚维降维中,亲和力=“预先计算”意味着什么?它是如何使用的?但是,我不知道这个“预算法”实际上意味着什么,我是否必须为特征聚集算法提供“预先计算”的内容?“预先计算”究竟是什么意思?
除了原始数据预处理(缩放),numpy数组之外,我没有传递任何其他内容。在进行特征聚类的fit_transform后,将结果传递给Birch聚类算法,得到了比其他相似点更好的结果。结果与PCA相似,但内存消耗开销要低得多,所以我会使用特征聚集作为降维,但我担心我做错了吗?
发布于 2018-09-29 22:53:44
问得好。
affinity == 'precomputed'
意味着使用包含原始数据的distance matrix
上三角形的扁平数组。
参考资料(源代码):
if affinity == 'precomputed': # for the linkage function of hierarchy to work on precomputed # data, provide as first argument an ndarray of the shape returned # by pdist: it is a flat array containing the upper triangular of # the distance matrix. i, j = np.triu\_indices(X.shape[0], k=1) X = X[i, j] elif affinity == 'l2': # Translate to something understood by scipy affinity = 'euclidean' elif affinity in ('l1', 'manhattan'): affinity = 'cityblock'
https://stackoverflow.com/questions/52538559
复制相似问题