Skip to content

Conversation

@samland1116
Copy link
Contributor

I was able to get the unpack_results functionality to work as intended (prior to this update) like:

# Define a bootstrapper with custom parameters.
boot = teehr.Bootstrappers.Gumboot(
    reps=500,
    quantiles=[0.05, 0.5, 0.95],
)

metrics_sdf = ev.metrics.query(
    group_by=[
        "primary_location_id",
        "configuration_name"
    ],
    include_metrics=[
        teehr.DeterministicMetrics.RelativeBias(
            bootstrap=boot,
            unpack_results=True # defined here instead
        )
    ]
).to_sdf()

When applying the bootstrapper in teehr.querying.metric_format.apply_aggregation_metrics(), we were not checking if the bootstrap.unpack_results attribute was set or not. The unpacking hinged solely on if you defined the argument when instantiating the metric function you are bootstrapping.

I updated teehr.querying.metric_format.apply_aggregation_metrics() to check the bootstrap attributes for unpack_results. This allows you to define the unpack_results arg when instantiating the bootstrap and/or when defining the metric you apply the bootstrap to (i.e. the code Matt attached in the issue works in addition to the above).

@samland1116 samland1116 added this to the v0.6 Release milestone Nov 18, 2025
@samland1116 samland1116 self-assigned this Nov 18, 2025
@samland1116 samland1116 added bug Something isn't working v0.6-dev Denotes that the issue is meant to be merged into the v0.6-beta development branch. main This is an issue that is considered v0.5.0 maintenance and should be merged into main priority: High This is blocking work, let's get it done as soon as possible. labels Nov 18, 2025
@samland1116 samland1116 linked an issue Nov 20, 2025 that may be closed by this pull request
@samlamont
Copy link
Collaborator

I think the BootstrapBasemodel may be at fault here, in that it inherits the MetricsBasemodel which has the unpack_results field. So in the above example we have boot model that is added to the RelativeBias metric, but they have redundant fields since they both inherit the MetricsBasemodel.

Seems like maybe we should remove them from the BootstrapBasemodel (or MetricsBasemodel?) so we only have to check the condition once. Maybe we can discuss next week

@samlamont samlamont merged commit c095b03 into main Dec 5, 2025
@samlamont samlamont deleted the 587-unpack-results-may-not-work branch December 5, 2025 20:27
samlamont added a commit that referenced this pull request Dec 5, 2025
* corrects error with unpack_results argument

* update bootstrap pydantic models

---------

Co-authored-by: samlamont <sam.lamont@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working main This is an issue that is considered v0.5.0 maintenance and should be merged into main priority: High This is blocking work, let's get it done as soon as possible. v0.6-dev Denotes that the issue is meant to be merged into the v0.6-beta development branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unpack results may not work

3 participants