skbio.stats.distance.SymmetricMatrix.permute#

SymmetricMatrix.permute(condensed=False, seed=None)[source]#

Randomly permute both rows and columns in the matrix.

Randomly permutes the ordering of rows and columns in the matrix. The same permutation is applied to both rows and columns in order to maintain symmetry and, if applicable, hollowness. Only the rows/columns in the matrix are permuted; the IDs are not permuted.

Parameters:
condensedbool, optional

If True, return the permuted distance matrix in condensed format. Otherwise, return the permuted distance matrix as a new SymmetricMatrix instance. Can only be True if operating on a DistanceMatrix.

seedint, Generator or RandomState, optional

A user-provided random seed or random generator instance. See details.

Added in version 0.6.3.

Returns:
SymmetricMatrix or ndarray

Permuted values as a new DistanceMatrix or as a ndarray in condensed format.

See also

condensed_form

Notes

This method does not modify the distance matrix that it is called on. It is more efficient to pass condensed=True than permuting the distance matrix and then converting to condensed format.