Reputation: 79
I have implemented hrp as described in the link below. I run with different inputs. The code produces reasonable results but I get the error message:
"main:75: ClusterWarning: scipy.cluster: The symmetric non-negative hollow observation matrix looks suspiciously like an uncondensed distance matrix"
Can anybody explain what it means?
link for code: https://github.com/lcamposgarrido/data-science_projects/blob/master/others/hierarchical_risk_parity/HRP.ipynb
Upvotes: 3
Views: 2566
Reputation: 1102
The scipy.cluster.hierarchy.linkage
function accepts either a 1-D condensed distance matrix or a 2-D array of observation vectors. The warning just means your passing a 2-D matrix that looks like a redundant distance matrix (non-negative, symmetric, diagonal all zeros), but it is being treated as a 2-D observation matrix. If it is actually a distance matrix it should be converted to the condensed form before passing to scipy.cluster.hierarchy.linkage
. The scipy.spatial.distance.squareform
function may be used to convert between the two distance matrix forms.
Upvotes: 1