Skip to main content

join

Function join 

Source
pub fn join(
    predictions: &[PredictionLine],
    gold: &[GoldLine],
) -> Result<Vec<Sample>>
Expand description

Join predictions with gold by id, validating both sides.

Failures are loud and specific, because every one of them would otherwise turn into a quietly wrong number:

  • a duplicate id on either side;
  • a prediction row whose id is not in the gold file (the two files are out of sync — evaluating the overlap would hide exactly the rows that differ);
  • a probability vector whose length disagrees with option_ids;
  • a non-finite or negative probability;
  • a gold slot that is not among the row’s declared options.