Ranker
- class rectools.models.rank.rank.Ranker(*args, **kwargs)[source]
Bases:
ProtocolProtocol for all rankers
- Inherited-members
Methods
rank(subject_ids[, k, filter_pairs_csr, ...])Rank objects by corresponding embeddings.
- rank(subject_ids: Union[Sequence[int], ndarray], k: Optional[int] = None, filter_pairs_csr: Optional[csr_matrix] = None, sorted_object_whitelist: Optional[ndarray] = None) Tuple[Union[Sequence[int], ndarray], Union[Sequence[int], ndarray], Union[Sequence[float], ndarray]][source]
Rank objects by corresponding embeddings.
- Parameters
subject_ids (InternalIds) – Array of ids to recommend for.
k (int, optional, default
None) – Derived number of recommendations for every subject id. Return all recs if None.filter_pairs_csr (sparse.csr_matrix, optional, default
None) – Subject-object interactions that should be filtered from recommendations. This is relevant for u2i case.sorted_object_whitelist (sparse.csr_matrix, optional, default
None) – Whitelist of object ids. If given, only these items will be used for recommendations. Otherwise all items from dataset will be used.
- Returns
Array of subject ids, array of recommended items, sorted by score descending and array of scores.
- Return type
(InternalIds, InternalIds, Scores)