GithubHelp home page GithubHelp logo

[Feature Request] stddev statistic about ranx HOT 3 CLOSED

amenra avatar amenra commented on July 30, 2024
[Feature Request] stddev statistic

from ranx.

Comments (3)

AmenRa avatar AmenRa commented on July 30, 2024 2

Hi! Yes, I should add it.

In the mean time, you can compute it as follows:

from ranx import Qrels, Run, evaluate
import numpy as np

qrels_dict = { "q_1": { "d_12": 5, "d_25": 3 },
               "q_2": { "d_11": 6, "d_22": 1 } }

run_dict = { "q_1": { "d_12": 0.9, "d_23": 0.8, "d_25": 0.7,
                      "d_36": 0.6, "d_32": 0.5, "d_35": 0.4  },
             "q_2": { "d_12": 0.9, "d_11": 0.8, "d_25": 0.7,
                      "d_36": 0.6, "d_22": 0.5, "d_35": 0.4  } }

qrels = Qrels(qrels_dict)
run = Run(run_dict)

evaluate(qrels, run, ["map@5", "mrr"])

print(np.std(list(run.scores["map@5"].values())))
print(np.std(list(run.scores["mrr"].values())))

from ranx.

AmenRa avatar AmenRa commented on July 30, 2024 2

Added support for standard deviation in v0.3.19.

Example:

from ranx import Qrels, Run, evaluate

qrels_dict = { "q_1": { "d_12": 5, "d_25": 3 },
               "q_2": { "d_11": 6, "d_22": 1 } }

run_dict = { "q_1": { "d_12": 0.9, "d_23": 0.8, "d_25": 0.7,
                      "d_36": 0.6, "d_32": 0.5, "d_35": 0.4  },
             "q_2": { "d_12": 0.9, "d_11": 0.8, "d_25": 0.7,
                      "d_36": 0.6, "d_22": 0.5, "d_35": 0.4  } }

qrels = Qrels(qrels_dict)
run = Run(run_dict)

evaluate(qrels, run, ["map@5", "mrr"], return_std=True)

Output:

{'map@5': {'mean': 0.6416666666666666, 'std': 0.19166666666666662},
 'mrr': {'mean': 0.75, 'std': 0.25}}

Metrics standard deviations can later be accessed as follows:

run.std_scores

Output:

{'map@5': 0.19166666666666662, 'mrr': 0.25}

Please, consider giving ranx a star if you haven't yet. :)

from ranx.

jamm1985 avatar jamm1985 commented on July 30, 2024

@AmenRa thank you!

from ranx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.