ertk.utils.inst_to_flat

ertk.utils.inst_to_flat(x: ndarray) Tuple[ndarray, ndarray]

The inverse of flat_to_inst(). Takes an instance ‘matrix’ and converts to a “flattened” 2D matrix.

Parameters:
x: numpy.ndarray

The instance matrix, which is either a contiguous 2D or 3D array, or an array of 1D or 2D arrays.

Returns:
flat: numpy.ndarray

The contiguous 2D matrix containing data for all instances.

slices: numpy.ndarray

Array of slices (sequence lengths) in flat. It should be the case that x[i] == flat[s : s + slices[i]], where s = sum(slices[:i]).