Skip to content

Document the label_threshold parameter in get_studies_by_label - #1084

Open
lobennett wants to merge 1 commit into
neurostuff:mainfrom
lobennett:doc/label-threshold-docstring
Open

Document the label_threshold parameter in get_studies_by_label#1084
lobennett wants to merge 1 commit into
neurostuff:mainfrom
lobennett:doc/label-threshold-docstring

Conversation

@lobennett

@lobennett lobennett commented Jun 22, 2026

Copy link
Copy Markdown

The label_threshold parameter of Dataset.get_studies_by_label was documented only as "Default is 0.5.", which is both wrong (the default is 0.001) and unexplained.

This rewrites the entry to state the correct default and explain the threshold: a study is included when its annotation value for every requested label is >= label_threshold, and for Neurosynth-style annotations those values are tf-idf weights (higher = the term is more important to that study's text relative to the corpus), so the threshold is only interpretable within the corpus the annotations were derived from. (Per the discussion in the issue.)

Docstring-only; no behavior change. flake8 nimare/dataset.py passes.

Closes #950

Summary by Sourcery

Documentation:

  • Expand the documentation of Dataset.get_studies_by_label.label_threshold to describe its inclusion criteria, tf-idf semantics for Neurosynth-style annotations, and correct the documented default value to 0.001.

@welcome

welcome Bot commented Jun 22, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! We have detected this is the first time you have contributed to NiMARE. Please check out our contributing guidelines.
We invite you to list yourself as a NiMARE contributor, so if your name is not already mentioned, please modify the .zenodo.json file with your data right above Angie's entry. Example:

{
  "name": "Contributor, New",
  "affiliation": "Department of Psychology, Some University",
  "orcid": "<your id>"
},
{
  "name": "Laird, Angela R.",
  "affiliation": "Florida International University",
  "orcid": "0000-0003-3379-8744"
},

Of course, if you want to opt out this time there is no problem at all with adding your name later. You will be always welcome to add it in the future whenever you feel it should be listed.

@sourcery-ai

sourcery-ai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the docstring for Dataset.get_studies_by_label to correctly describe the label_threshold parameter’s behavior, semantics, and default value, without changing any runtime behavior.

File-Level Changes

Change Details Files
Clarified and corrected the documentation of the label_threshold parameter in Dataset.get_studies_by_label.
  • Explain that a study is included only when its annotation value for every requested label is greater than or equal to label_threshold.
  • Document that, for Neurosynth-style annotations, the values are tf-idf weights and describe their corpus-relative meaning.
  • Clarify that the label_threshold default is 0.001 instead of 0.5 and expand the explanatory text accordingly.
nimare/dataset.py

Assessment against linked issues

Issue Objective Addressed Explanation
#950 Document how the label_threshold parameter in Dataset.get_studies_by_label works, including its role in selecting studies based on label values.
#950 Correctly document the default value of the label_threshold parameter for Dataset.get_studies_by_label.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.50%. Comparing base (ba8d921) to head (cbc014e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1084   +/-   ##
=======================================
  Coverage   85.50%   85.50%           
=======================================
  Files          56       56           
  Lines       11248    11248           
=======================================
  Hits         9618     9618           
  Misses       1630     1630           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation for label_threshold

1 participant