Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default metrics in CLI #52

Merged
merged 3 commits into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion elinor-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "elinor-cli"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
authors = ["Shunsuke Kanda (kampersanda) <shnsk.knd@gmail.com>"]
description = "Command line tools for elinor."
Expand Down
4 changes: 2 additions & 2 deletions elinor-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ elinor-evaluate \

The available metrics are shown in [Metric](https://docs.rs/elinor/latest/elinor/metrics/enum.Metric.html).

The output will show the basic statistics and the macro-averaged scores for each metric:
The output will show several basic statistics and the macro-averaged scores for each metric:

```
n_queries_in_true 8
n_queries_in_pred 8
n_docs_in_true 20
n_docs_in_pred 24
n_true_relevant_docs 14
n_relevant_docs 14
precision@3 0.5833
ap 0.8229
rr 0.8125
Expand Down
8 changes: 4 additions & 4 deletions elinor-cli/src/bin/evaluate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct Args {
#[arg(long)]
tab_separator: bool,

/// Metric to evaluate.
/// Metric to evaluate. If not specified, some default metrics are used.
#[arg(short, long, num_args = 1..)]
metrics: Vec<Metric>,
}
Expand Down Expand Up @@ -58,7 +58,7 @@ fn main() -> Result<()> {
println!("n_queries_in_pred\t{}", pred_rels.n_queries());
println!("n_docs_in_true\t{}", true_rels.n_docs());
println!("n_docs_in_pred\t{}", pred_rels.n_docs());
println!("n_true_relevant_docs\t{}", n_relevant_docs(&true_rels));
println!("n_relevant_docs\t{}", n_relevant_docs(&true_rels));

let mut columns = vec![];
for metric in metrics {
Expand Down Expand Up @@ -101,12 +101,12 @@ fn default_metrics() -> Vec<Metric> {
for k in [5, 10, 15, 20] {
metrics.push(Metric::Precision { k });
}
for k in [5, 10, 15, 20] {
for k in [5, 10, 15, 20, 0] {
metrics.push(Metric::AP { k });
}
metrics.push(Metric::RR { k: 0 });
for k in [5, 10, 15, 20] {
metrics.push(Metric::NDCG { k });
}
metrics.push(Metric::RR { k: 0 });
metrics
}
2 changes: 1 addition & 1 deletion scripts/compare_with_trec_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def compare_decimal_places(a: str, b: str, decimal_places: int) -> bool:
("num_q", "n_queries_in_true"),
("num_q", "n_queries_in_pred"),
("num_ret", "n_docs_in_pred"),
("num_rel", "n_true_relevant_docs"),
("num_rel", "n_relevant_docs"),
]
)

Expand Down
Loading