RetrievalEvaluation#
- class scikitplot.corpus.RetrievalEvaluation(metrics, queries, settings, metadata=<factory>)[source]#
Result of
evaluate_retrieval.- Parameters:
- metricsmapping
Metric name to the mean over queries (undefined values excluded under
zero_division=np.nan).- queriestuple of QueryEvaluation
Per-query results, in evaluation order.
- settingsmapping
The options the evaluation ran with.
- metadatamapping, default={}
Free-form, JSON-compatible description supplied by the caller.
- Parameters:
Notes
User note.
writepicks the format from the file suffix:.json,.jsonl/.ndjson(one row per query),.yaml/.ymlor.toml.readrestores a report from JSON, YAML or TOML.- compare(baseline, *, n_resamples=10000, seed=0)[source]#
Compare this evaluation with
baselineover the same queries.- Parameters:
- baselineRetrievalEvaluation
Evaluation of the same query identifiers.
- n_resamplesint, default=10000
Random sign flips when the pairs exceed
EXACT_SIGN_FLIP_LIMIT; below it every flip is enumerated.- seedint, default=0
Non-negative seed of the random flips, so the p-value is reproducible.
- Returns:
- EvaluationComparison
- Raises:
- TypeError
If
baselineis not aRetrievalEvaluation.- ValueError
If the query sets differ or no metric is shared.
- Parameters:
baseline (RetrievalEvaluation)
n_resamples (int)
seed (int)
- Return type:
Notes
Per metric, only queries defined in both evaluations are paired. The statistic is
|sum(d)|over the per-query differencesd(the mean up to the constant number of pairs); the p-value counts sign flips whose statistic reaches the observed one (+1in numerator and denominator when flips are sampled). A flip within4 * n * eps * sum(|d|)of the observed statistic counts as reaching it, so flips equal for the values the metrics represent are not lost to floating-point rounding; the p-value errs on the conservative side.
- classmethod from_dict(data)[source]#
Rebuild a report from
to_dictoutput.- Raises:
- ValueError
If the schema or its version is not this one.
- Parameters:
- Return type:
- classmethod read(path, format=None)[source]#
Read a report written by
writein JSON, YAML or TOML.- Raises:
- ValueError
For JSON Lines, which holds the per-query rows only.
- Parameters:
- Return type:
- property status_counts: dict[str, int]#
Number of queries per response status (
"unreported"for none).