I have a correlation coefficient matrix (n*n). How to do clustering using the correlation coefficient matrix?
Can I use linkage and fcluster function in SciPy?
Linkage function needs n * m
matrix (according to tutorial), but I want to use n*n matrix.
My code is
corre = mp_N.corr() # mp_N is raw data (m*n matrix)
Z = linkage(corre, method='average') # 'corre' is correlation coefficient matrix
fcluster(Z,2,'distance')
Is this code right? If this code is wrong, how can I do clustering with correlation coefficient matrix?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With