instancelib.utils.numpy module

instancelib.utils.numpy.chunk_combiner(chunks)[source]
Parameters:

chunks (Iterable[Tuple[Sequence[TypeVar(KT)], ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]]]) –

Return type:

Tuple[Sequence[TypeVar(KT)], ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]]

instancelib.utils.numpy.combiner(chunk_a, chunk_b)[source]
Parameters:
Return type:

Tuple[Sequence[TypeVar(KT)], ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]]

instancelib.utils.numpy.get_lists(slices)[source]
Parameters:

slices (Iterable[Tuple[int, Optional[int]]]) –

Return type:

Sequence[int]

instancelib.utils.numpy.matrix_to_vector_list(matrix)[source]
Parameters:

matrix (ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]) –

Return type:

Sequence[ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]]

instancelib.utils.numpy.matrix_tuple_to_vectors(keys, matrix)[source]
Parameters:
Return type:

Tuple[Sequence[TypeVar(KT)], Sequence[ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]]]

instancelib.utils.numpy.matrix_tuple_to_zipped(keys, matrix)[source]
Parameters:
Return type:

Sequence[Tuple[TypeVar(KT), ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]]]

instancelib.utils.numpy.memslicer(matrix, slices)[source]
Parameters:
Return type:

ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]

instancelib.utils.numpy.slicer(matrix, slices)[source]
Parameters:
Return type:

ndarray[Any, dtype[TypeVar(DType, float64, int32, int64, float32, float16, bool_)]]

instancelib.utils.numpy.to_bicolumn_proba(matrix)[source]

Converts a matrix to bi column probability matrix if it is a single column matrix. Otherwhise, no changes occurs.

Parameters:

matrix (npt.NDArray[Any]) – An input matrix that is possibly a single column matrix

Returns:

The converted matrix

Return type:

npt.NDArray[Any]