scipy.cluster.hierarchy.from_mlab_linkage(Z)[source]

Convert 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] represents the number of original observations (leaves) in the non-singleton cluster i.

Parameters: Z : ndarray A linkage matrix generated by MATLAB(TM). ZS : ndarray A linkage matrix compatible with scipy.cluster.hierarchy.