1. 調用方法:
AffinityPropagation
(damping=0.5, max_iter=200, convergence_iter=15, copy=True, preference=None, affinity=’euclidean’, verbose=False)
參數:
damping : float, optional, default: 0.5 防止更新過程中數值震盪
max_iter : int, optional, default: 200
convergence_iter : int, optional, default: 15
如果類簇數目在達到這么多次迭代以后仍然不變的話,就停止迭代。
copy : boolean, optional, default: True
Make a copy of input data.
preference : array-like, shape (n_samples,) or float, optional
每個points的preference。具有更大preference的點更可能被選為exemplar。類簇的數目受此值的影響,如果沒有傳遞此參數,它們 會被設置成input similarities的中值。???
affinity : string, optional, default=``euclidean``
度量距離的方式,推薦precomputed
and euclidean這兩種,
euclidean
uses the negative squared euclidean distance between points.
verbose : boolean, optional, default: False
屬性:
cluster_centers_indices_ : array, shape (n_clusters,)
類簇中心的索引
cluster_centers_ : array, shape (n_clusters, n_features)
類簇中心 (if affinity != precomputed
)
labels_ : array, shape (n_samples,)
每個point的標簽
affinity_matrix_ : array, shape (n_samples, n_samples)
Stores the affinity matrix used in fit
.
n_iter_ : int
達到收斂需要的迭代次數。
2. scikit-learn介紹
http://scikit-learn.org/stable/modules/clustering.html#affinity-propagation
3. 算法復雜性
,與樣本數成正比。
4.算法描述
引入阻尼因子: