recpack.postprocessing.filters.SelectItems

class recpack.postprocessing.filters.SelectItems(items: Union[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]], numpy._typing._nested_sequence._NestedSequence[numpy._typing._array_like._SupportsArray[numpy.dtype[Any]]], bool, int, float, complex, str, bytes, numpy._typing._nested_sequence._NestedSequence[Union[bool, int, float, complex, str, bytes]]])

Select only the recommendations of specified items. https://numpy.org/doc/stable/reference/typing.html#numpy.typing.ArrayLike

Parameters

items (ArrayLike) – ArrayLike with the identifiers for items to be selected

Methods

apply(X_pred)

Process the predictions, and return the processed matrix.

apply_all(*csr_matrices)

Apply the filter to each of the matrices.

apply(X_pred: scipy.sparse._csr.csr_matrix) scipy.sparse._csr.csr_matrix

Process the predictions, and return the processed matrix.

Parameters

X_pred (csr_matrix) – csr_matrix to filter

Returns

The processed csr_matrix.

Return type

csr_matrix

apply_all(*csr_matrices: scipy.sparse._csr.csr_matrix) List[scipy.sparse._csr.csr_matrix]

Apply the filter to each of the matrices.

Parameters

csr_matrices (csr_matrix) – The matrices to apply the filter to.

Returns

The list of processed csr_matrices

Return type

List[csr_matrix]