Skip to content

aggregate defaults to mean#653

Merged
blooop merged 2 commits intomainfrom
feature/agg_mean
Sep 16, 2025
Merged

aggregate defaults to mean#653
blooop merged 2 commits intomainfrom
feature/agg_mean

Conversation

@blooop
Copy link
Copy Markdown
Owner

@blooop blooop commented Sep 16, 2025

Summary by Sourcery

Default aggregation behavior now uses mean instead of sum across core methods and update version accordingly

Enhancements:

  • Change default aggregation function from sum to mean in dataset renaming and filtering methods
  • Update fallback behavior for unknown aggregation functions to use mean instead of sum

Build:

  • Bump package version to 1.56.1

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Sep 16, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR changes the default aggregation function from sum to mean throughout the bench_result modules (including fallback behavior), updates parameter defaults in filter and to methods, and bumps the package version to 1.56.1 with corresponding lock file update.

Class diagram for updated aggregation defaults in BenchResult modules

classDiagram
    class BenchResultBase {
        +rename_ds(dataset: xr.Dataset, suffix: str)
        - Default aggregation fallback: mean (was sum)
    }
    class BenchResult {
        +to(..., agg_fn: Literal["sum", "mean", "max", "min", "median"] = "mean", ...)
        - Default agg_fn parameter: mean (was sum)
    }
    BenchResultBase <|-- BenchResult
    class Filter {
        +filter(..., agg_fn: Literal["sum", "mean", "max", "min", "median"] = "mean", ...)
        - Default agg_fn parameter: mean (was sum)
    }
Loading

File-Level Changes

Change Details Files
Default aggregation behavior in rename_ds switched to mean
  • Default fn assignment updated from sum to mean
  • Fallback aggregation adjusted to mean and comments updated accordingly
bencher/results/bench_result_base.py
agg_fn default parameter in filter() changed to mean
  • filter() signature default changed from "sum" to "mean"
bencher/results/bench_result_base.py
agg_fn default parameter in to() method changed to mean
  • to() method signature default changed from "sum" to "mean"
bencher/results/bench_result.py
Package version bumped to 1.56.1
  • pyproject.toml version updated from 1.56.0 to 1.56.1
  • Lock file regenerated
pyproject.toml
pixi.lock

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

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Consider centralizing the aggregation logic (default choice and fallback) into a shared helper function to reduce duplication and ensure consistency across methods.
  • Instead of silently falling back to mean on unrecognized agg_fn strings, it may be safer to raise an error or emit a warning so typos don’t go unnoticed.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider centralizing the aggregation logic (default choice and fallback) into a shared helper function to reduce duplication and ensure consistency across methods.
- Instead of silently falling back to mean on unrecognized agg_fn strings, it may be safer to raise an error or emit a warning so typos don’t go unnoticed.

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.

@blooop blooop enabled auto-merge September 16, 2025 15:58
@blooop blooop merged commit 1c956a4 into main Sep 16, 2025
7 of 8 checks passed
@blooop blooop deleted the feature/agg_mean branch September 16, 2025 15:59
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.

1 participant