Elinor: Evaluation Library in Information Retrieval
Elinor is a Rust library for evaluating information retrieval systems, which is inspired by ranx.
Features
- IRer-friendly: The library is designed to be easy to use for developers in information retrieval by providing TREC-like data structures, such as Qrels and Run.
- Flexible:
The library supports various evaluation metrics, such as Precision, MAP, MRR, and nDCG.
The supported metrics are available in
Metric.
Documentation
Or, you can build and open the documentation locally by running the following command:
RUSTDOCFLAGS="--html-in-header katex.html"
Getting Started
A simple routine to prepare Qrels and Run data and evaluate them using Precision@3, MAP, MRR, and nDCG@3:
use ;
// Construct Qrels data.
let mut qb = new;
qb.add_score?;
qb.add_score?;
qb.add_score?;
qb.add_score?;
qb.add_score?;
let qrels = qb.build;
// Construct Run data.
let mut rb = new;
rb.add_score?;
rb.add_score?;
rb.add_score?;
rb.add_score?;
rb.add_score?;
rb.add_score?;
let run = rb.build;
// The metrics to evaluate can be specified via Metric instances.
let metrics = vec!;
// Evaluate the qrels and run data.
let evaluated = evaluate?;
// Macro-averaged scores.
for metric in &metrics
// => precision@3: 0.5000
// => ap: 0.5000
// => rr: 0.6667
// => ndcg@3: 0.4751
Other examples are available in the examples directory.
Licensing
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.