skbio.stats.distance.DistanceMatrix.permute#
- DistanceMatrix.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 hollowness. Only the rows/columns in the distance 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 newDistanceMatrix
instance.- seedint, Generator or RandomState, optional
A user-provided random seed or random generator instance. See
details
.Added in version 0.6.3.
- Returns:
- DistanceMatrix or ndarray
Permuted distances as a new
DistanceMatrix
or as andarray
in condensed format.
See also
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.