query

microscopes.common.query

Common helpers for model query interfaces.

Note you should generally be calling the model-specific query interfaces.

microscopes.common.query.groups(avec, sort=False)

Turn an assignment vector in a clustering.

Parameters:

avec : assignment vector

sort : bool, default False

Whether or not the order of the clusters should be sorted by descending size (largest groups first)

Returns:

clustering : a list of lists

Note that len(clustering) == len(np.unique(avec))

microscopes.common.query.zmatrix(assignments)
microscopes.common.query.zmatrix_heuristic_block_ordering(zmat)

Heuristically generate a permutation of the axes of zmat which results in block-diagonal sub-matrices.

Parameters:

zmat : (N, N) ndarray

Returns:

order : (N,) ndarray

A permutation on \([N]\) which heuristically generates the most block diagonal sub-matrices after re-ordering

microscopes.common.query.zmatrix_reorder(zmat, order)

Reorder a z-matrix given a permutation

Parameters:

zmat : (N, N) ndarray

order : (N,) ndarray

Returns:

reordered : (N, N) ndarray

A new z-matrix with both columns and rows of zmat permuted according to order.

Datamicroscopes is developed by Qadium, with funding from the DARPA XDATA program. Copyright Qadium 2015.