Skip to content

LTRRanker

Learning-to-rank over decision-occasion groups, with LightGBM (LambdaMART / XE-NDCG) and CatBoost (YetiRank) backends and group-aware NDCG@k tuning. See the learning-to-rank guide.

In short

  • LTRRanker(cfg).fit(df) returns a deployable FittedLTRPipeline directly; its result holds the ranking report, best_valid_ndcg and feature importances.
  • Configure it with parleml_ml4.ltr.LTRConfig, or start from the ltr_fast / ltr_balanced / ltr_thorough factories in parleml_ml4.ltr.config.
  • ranker_objective picks the training loss and library; ranking_objective picks how the holdout is reported.
  • Pass outputs_dir= to persist the pipeline under <outputs_dir>/deploy/ltr/.

LTRRanker

LTRRanker(
    config: LTRConfig, *, outputs_dir: Optional[str] = None
)

Fit a learning-to-rank model end-to-end and persist a pipeline.

fit

fit(
    df: DataFrame,
    *,
    feature_cols: Optional[Sequence[str]] = None
) -> FittedLTRPipeline

Fit the ranker over df and return a deployable pipeline.

feature_cols defaults to every non-reserved column (entity / product / label / timestamp / bundle / holdings / group columns are reserved); on the event grain, columns that describe the purchased item are excluded too (:func:~parleml_ml4.ltr.frame.item_attribute_columns). An explicit list is used as given; on the event grain the run warns when it names such a column.

resolved_split_strategy

resolved_split_strategy() -> str

The concrete strategy split_strategy='auto' resolves to (LR4-04 / X4-1).

temporal when a timestamp is available to order occasions by, else entity. Never plain random: a group is (entity, occasion) whenever bundle_col or timestamp_col is set, so a random split over occasions puts a customer's other baskets in training while their held-out basket is graded, with no time ordering to make that realistic. (When groups are entities — neither knob set — the entity split and the random split are the same partition, so auto costs nothing there.)

Next: Learning-to-rank guide · Recommender