You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use diffusion_map to obtain the embedding and eigenvalues. I provided a symmetric cosine similarity matrix (no negative value) as input data with an alpha value of 0.5 and a diffusion time of 0. Although I obtained both the embedding and eigenvalues, I noticed that the eigenvalues are not sorted. Upon reviewing the code, I discovered that the eigval is a complex number ([eigvec, eigval] = eig(M)). As a result, the sorting ([eigval, idx] = sort(eigval,'descend');) did not work. I am wondering if this is because I used the wrong matrix for input? Thank you.
The text was updated successfully, but these errors were encountered:
Could you try running your matrix through the standard GradientMaps object with the kernel set to 'none', and other parameters set appropriately? This would be the recommended approach, and already handles some standard error cases. Does this yield the same outcome?
Thank you for your reply. I noticed that there is a slight difference between the MATLAB and Python code for diffusion_map estimation.
In MATLAB code, 'data' is the input matrix, and 'M' is the matrix for eigenvalue/eigenvector estimation.
'd = sum(data,2) .^ -alpha;
L = data .* (d*d.');
In Python code, 'adj' is the input matrix and also for the eigenvalue/eigenvector estimation.
' if alpha > 0:
if use_sparse:
d = np.power(adj.sum(axis=1).A1, -alpha)
adj.data *= d[adj.row]
adj.data *= d[adj.col]
else:
d = adj.sum(axis=1, keepdims=True)
d = np.power(d, -alpha)
adj *= d.T
adj *= d'
It looks like the matrix in MATLAB will be asymmetry for the eigenvalue estimation, and it won't happen in the Python code.
Hello,
I would like to use diffusion_map to obtain the embedding and eigenvalues. I provided a symmetric cosine similarity matrix (no negative value) as input data with an alpha value of 0.5 and a diffusion time of 0. Although I obtained both the embedding and eigenvalues, I noticed that the eigenvalues are not sorted. Upon reviewing the code, I discovered that the eigval is a complex number ([eigvec, eigval] = eig(M)). As a result, the sorting ([eigval, idx] = sort(eigval,'descend');) did not work. I am wondering if this is because I used the wrong matrix for input? Thank you.
The text was updated successfully, but these errors were encountered: