scipy.cluster.hierarchy.from_mlab_linkage¶
- scipy.cluster.hierarchy.from_mlab_linkage(Z)[source]¶
Converts a linkage matrix generated by MATLAB(TM) to a new linkage matrix compatible with this module.
The conversion does two things:
- the indices are converted from 1..N to 0..(N-1) form, and
- a fourth column Z[:,3] is added where Z[i,3] is represents the number of original observations (leaves) in the non-singleton cluster i.
This function is useful when loading in linkages from legacy data files generated by MATLAB.
Parameters: Z : ndarray
A linkage matrix generated by MATLAB(TM).
Returns: ZS : ndarray
A linkage matrix compatible with this library.