RankNet

class lightning_ir.loss.pairwise.RankNet(temperature: float = 1)[source]

Bases: PairwiseLossFunction

RankNet loss function for pairwise ranking tasks. Originally proposed in: Learning to Rank using Gradient Descent

__init__(temperature: float = 1) None[source]

Methods

__init__([temperature])

compute_loss(output, batch)

Compute the RankNet loss.

compute_loss(output: LightningIROutput, batch: TrainBatch) torch.Tensor[source]

Compute the RankNet loss.

Parameters:
  • output (LightningIROutput) – The output from the model containing scores.

  • batch (TrainBatch) – The training batch containing targets.

Returns:

The computed loss.

Return type:

torch.Tensor