-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
affinity propagation result is not consistent with sklearn in python #131
Comments
Thanks for the report! You are most welcome to submit a fix. |
I double checked the results, they are same with some random tests. labels = af[:labels_] .+ 1 |
this issue still exist. The tests shows that it requires that the diagnal value should be the median value of the similarity matrix, otherwise the result is not consistent with python! This is my test code: using Distances
using Clustering
using LinearAlgebra
using Random
using Statistics
Random.seed!(123)
d = 10
n = 44
x = rand(d, n)
S = -pairwise(Euclidean(), x, x)
# set diagonal value to median value
# S = S - diagm(0 => diag(S)) + median(S)*I
R = affinityprop(S)
k = length(R.exemplars)
using PyCall
@pyimport sklearn.cluster as cl
af = cl.AffinityPropagation(affinity="precomputed")[:fit]( S )
ref_assignments = af[:labels_] .+ 1
@assert randindex(R.assignments, ref_assignments)[2]==1.0 |
the two clustering results are different. Julia version did not do any clustering since the assignment is just the index of each object! My similarity matrix is too large to show here.
The travis test also did not verify the correctness of the result.
The text was updated successfully, but these errors were encountered: