NatLibFi / Annif

Annif is a multi-algorithm automated subject indexing tool for libraries, archives and museums.
https://annif.org
Other
190 stars 41 forks source link

Show scores in outputs of `suggest`, `eval` and `index` with 4 decimals #704

Closed juhoinkinen closed 1 year ago

juhoinkinen commented 1 year ago

Currently the output of annif suggest (to stdout) and annif index (to document.annif file) is e.g. as follows:

<http://www.yso.fi/onto/yso/p109998>    Röyttä (Ii) 0.4971785247325897
<http://www.yso.fi/onto/yso/p38304> stabiilius (muuttumattomuus)    0.4472784399986267
<http://www.yso.fi/onto/yso/p10546> hydrodynamiikka 0.4472784399986267
<http://www.yso.fi/onto/yso/p2048>  jääliikenne 0.44725048542022705
<http://www.yso.fi/onto/yso/p4911>  laivat  0.42701175808906555
<http://www.yso.fi/onto/yso/p12284> hinaajat    0.40847617387771606
<http://www.yso.fi/onto/yso/p19211> hydrostatiikka  0.3946342170238495
<http://www.yso.fi/onto/yso/p17953> rahtilaivat 0.37881672382354736
<http://www.yso.fi/onto/yso/p16317> höyrylaivat 0.36528536677360535
<http://www.yso.fi/onto/yso/p3976>  koneistot   0.3235071897506714

And the output of annif eval:

Precision (doc avg):            0.12500000000000003
Recall (doc avg):               0.2593537414965987
F1 score (doc avg):             0.16722522342270243
Precision (subj avg):           0.0006919161493665802
Recall (subj avg):              0.0005637320849872252
F1 score (subj avg):            0.00058845613207959
Precision (weighted subj avg):  0.42108585858585856
Recall (weighted subj avg):     0.26515151515151514
F1 score (weighted subj avg):   0.3055555555555555
Precision (microavg):           0.125
Recall (microavg):              0.26515151515151514
F1 score (microavg):            0.16990291262135923
F1@5:                           0.17080142080142083
NDCG:                           0.23108215630054474
NDCG@5:                         0.19264987111091614
NDCG@10:                        0.23108215630054474
Precision@1:                    0.21428571428571427
Precision@3:                    0.21428571428571425
Precision@5:                    0.17142857142857149
True positives:                 35
False positives:                245
False negatives:                97
Documents evaluated:            28

The very many decimals make reading the outputs a bit hard, but they don't offer any significant value.

This PR makes the shown scores to be rounded to 4 decimal places.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (2d1d3ce) 99.66% compared to head (ada1419) 99.66%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #704 +/- ## ======================================= Coverage 99.66% 99.66% ======================================= Files 89 89 Lines 6288 6293 +5 ======================================= + Hits 6267 6272 +5 Misses 21 21 ``` | [Impacted Files](https://app.codecov.io/gh/NatLibFi/Annif/pull/704?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi) | Coverage Δ | | |---|---|---| | [annif/cli.py](https://app.codecov.io/gh/NatLibFi/Annif/pull/704?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvY2xpLnB5) | `100.00% <100.00%> (ø)` | | | [annif/cli\_util.py](https://app.codecov.io/gh/NatLibFi/Annif/pull/704?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-YW5uaWYvY2xpX3V0aWwucHk=) | `99.00% <100.00%> (+0.01%)` | :arrow_up: | | [tests/test\_cli.py](https://app.codecov.io/gh/NatLibFi/Annif/pull/704?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=NatLibFi#diff-dGVzdHMvdGVzdF9jbGkucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.