RankerBase

class rectools.models.ranking.candidate_ranking.RankerBase(*args, **kwargs)[source]

Bases: Protocol

A protocol that defines the interface for a ranker model. Classes implementing this protocol should provide methods for fitting the model and predicting scores for ranking.

fit()[source]

Fit the ranker to the training data.

Parameters
  • args (Any) –

  • kwargs (Any) –

Return type

Self

predict()[source]

Predict scores for the given input data. The implementation should return an array of scores that can be used for ranking items.

Parameters
  • args (Any) –

  • kwargs (Any) –

Return type

ndarray

Inherited-members

Methods

fit(*args, **kwargs)

Fit the ranker to the training data.

predict(*args, **kwargs)

Predict scores for the given input data.

fit(*args: Any, **kwargs: Any) Self[source]

Fit the ranker to the training data.

Parameters
  • *args (any) – Positional arguments for fitting the ranker.

  • **kwargs (any) – Keyword arguments for fitting the ranker.

Returns

The fitted ranker instance.

Return type

tpe.Self

predict(*args: Any, **kwargs: Any) ndarray[source]

Predict scores for the given input data.

Parameters
  • *args (any) – Positional arguments for predicting scores.

  • **kwargs (any) – Keyword arguments for predicting scores.

Returns

An array of predicted scores, which can be used for ranking items.

Return type

np.ndarray