PearsonCorrelation

class lightning_ir.loss.listwise.PearsonCorrelation[source]

Bases: ListwiseLossFunction

Pearson Correlation loss for listwise ranking tasks.

Pearson Correlation for listwise ranking maximizes the linear alignment between the vector of predicted scores and the vector of ground truth relevance labels, ensuring that the relative trends across the entire list are preserved regardless of the absolute scale of the scores.

Methods

compute_loss(output, batch)

Compute the Pearson Correlation loss.

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

Compute the Pearson Correlation 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