Skip to content

refactor(skore): Modify dataframe format of MetricsSummaryDisplay#1839

Draft
glemaitre wants to merge 8 commits intoprobabl-ai:mainfrom
glemaitre:is/1837
Draft

refactor(skore): Modify dataframe format of MetricsSummaryDisplay#1839
glemaitre wants to merge 8 commits intoprobabl-ai:mainfrom
glemaitre:is/1837

Conversation

@glemaitre
Copy link
Member

closes #1837

This PR intends to:

  • transform the internal format of the dataframe from wide to long when calling .summarize
  • make that .frame is converting from long to wide format when necessary
  • add the necessary API to frame to provide flexibility

@glemaitre glemaitre marked this pull request as draft June 15, 2025 10:03
@auguste-probabl
Copy link
Collaborator

Superseded by #2322 ? Please close if yes

@adrinjalali adrinjalali moved this from In progress to Todo in Labs Mar 2, 2026
github-merge-queue bot pushed a commit that referenced this pull request Mar 6, 2026
….frame()` (#2536)

<!--
🙌 Thanks for contributing a pull request!

If this is your first contribution, take a look at our contribution
guidelines:
https://docs.skore.probabl.ai/dev/contributing.html
-->
#### Change description
<!--
Please describe what your contribution changes for skore.

Here is some inspiration for what to write here:
- Are you adding a new feature? Fixing a bug?
- Can you give an example of your change in action, e.g. a snippet of
code or a plot?
- Is your change likely to break users' code?
- Are there any other details the reviewer should be aware of, such as
API design choices, performance characteristics or edge cases?

Please reference issues/PRs when possible, e.g. "Fixes #1234", "Closes
#3456", "See also #7890".
More information
[here](https://github.com/blog/1506-closing-issues-via-pull-requests).
-->


`EstimatorReport.metrics.summarize()` no longer accepts arguments
`flat_index` or `favorability`. These have been moved to
`MetricsSummaryDisplay.frame()`.
This moves the responsibility of displaying things from
`EstimatorReport._MetricsAccessor` to `MetricsSummaryDisplay`.

```python
# Before
report.metrics.summarize(flat_index=True, favorability=True).frame()

# After
report.metrics.summarize().frame(flat_index=True, favorability=True)
```

This is a breaking change.

The rest of the PR consists in various refactorings, in particular the
tests have been updated to reflect the change in responsibility:
- Tests of `summarize()` were extracted from
`tests/unit/reports/estimator/metrics/test_numeric.py` to a new file,
`tests/unit/reports/estimator/metrics/test_summarize.py`.
- `test_summarize.py` now tests that `summarize()` behaves well, and
that the output of `summarize()` has a well-formed DataFrame. `.frame()`
is never called.
- `displays/metrics_summary/test_estimator.py` has been rewritten to
specifically test `.frame()` arguments.

A number of commits are included that could be pulled out into a
separate PR if needed.

Closes #2533 
Supersedes #1839 in part

#### Contribution checklist
<!--
Below are some of the criteria that the review will include.
Feel free to use it as a checklist to ensure that your contribution is
high-quality.
-->

- [x] Unit tests were added or updated (if necessary)
- [x] Documentation was added or updated (if necessary)

#### AI usage disclosure
<!--
If AI tools were involved in creating this PR, please check all boxes
that apply
below and make sure you understand our [automated contributions
policy](https://docs.skore.probabl.ai/dev/contributing.html#automated-contributions-policy)
-->
AI tools were involved for:
- [ ] Code generation (e.g., when writing an implementation or fixing a
bug)
- [x] Test/benchmark generation
- [ ] Documentation (including examples)
- [ ] Research and understanding

In particular I used Claude to increase coverage.
<!-- Any other comments can go here. Thanks again for contributing! -->
direkkakkar319-ops pushed a commit to direkkakkar319-ops/skore_05 that referenced this pull request Mar 8, 2026
….frame()` (probabl-ai#2536)

<!--
🙌 Thanks for contributing a pull request!

If this is your first contribution, take a look at our contribution
guidelines:
https://docs.skore.probabl.ai/dev/contributing.html
-->
#### Change description
<!--
Please describe what your contribution changes for skore.

Here is some inspiration for what to write here:
- Are you adding a new feature? Fixing a bug?
- Can you give an example of your change in action, e.g. a snippet of
code or a plot?
- Is your change likely to break users' code?
- Are there any other details the reviewer should be aware of, such as
API design choices, performance characteristics or edge cases?

Please reference issues/PRs when possible, e.g. "Fixes probabl-ai#1234", "Closes
#3456", "See also #7890".
More information
[here](https://github.com/blog/1506-closing-issues-via-pull-requests).
-->

`EstimatorReport.metrics.summarize()` no longer accepts arguments
`flat_index` or `favorability`. These have been moved to
`MetricsSummaryDisplay.frame()`.
This moves the responsibility of displaying things from
`EstimatorReport._MetricsAccessor` to `MetricsSummaryDisplay`.

```python
# Before
report.metrics.summarize(flat_index=True, favorability=True).frame()

# After
report.metrics.summarize().frame(flat_index=True, favorability=True)
```

This is a breaking change.

The rest of the PR consists in various refactorings, in particular the
tests have been updated to reflect the change in responsibility:
- Tests of `summarize()` were extracted from
`tests/unit/reports/estimator/metrics/test_numeric.py` to a new file,
`tests/unit/reports/estimator/metrics/test_summarize.py`.
- `test_summarize.py` now tests that `summarize()` behaves well, and
that the output of `summarize()` has a well-formed DataFrame. `.frame()`
is never called.
- `displays/metrics_summary/test_estimator.py` has been rewritten to
specifically test `.frame()` arguments.

A number of commits are included that could be pulled out into a
separate PR if needed.

Closes probabl-ai#2533
Supersedes probabl-ai#1839 in part

#### Contribution checklist
<!--
Below are some of the criteria that the review will include.
Feel free to use it as a checklist to ensure that your contribution is
high-quality.
-->

- [x] Unit tests were added or updated (if necessary)
- [x] Documentation was added or updated (if necessary)

#### AI usage disclosure
<!--
If AI tools were involved in creating this PR, please check all boxes
that apply
below and make sure you understand our [automated contributions
policy](https://docs.skore.probabl.ai/dev/contributing.html#automated-contributions-policy)
-->
AI tools were involved for:
- [ ] Code generation (e.g., when writing an implementation or fixing a
bug)
- [x] Test/benchmark generation
- [ ] Documentation (including examples)
- [ ] Research and understanding

In particular I used Claude to increase coverage.
<!-- Any other comments can go here. Thanks again for contributing! -->
@adrinjalali adrinjalali removed this from Labs Mar 9, 2026
direkkakkar319-ops pushed a commit to direkkakkar319-ops/skore_05 that referenced this pull request Mar 9, 2026
….frame()` (probabl-ai#2536)

<!--
🙌 Thanks for contributing a pull request!

If this is your first contribution, take a look at our contribution
guidelines:
https://docs.skore.probabl.ai/dev/contributing.html
-->
#### Change description
<!--
Please describe what your contribution changes for skore.

Here is some inspiration for what to write here:
- Are you adding a new feature? Fixing a bug?
- Can you give an example of your change in action, e.g. a snippet of
code or a plot?
- Is your change likely to break users' code?
- Are there any other details the reviewer should be aware of, such as
API design choices, performance characteristics or edge cases?

Please reference issues/PRs when possible, e.g. "Fixes probabl-ai#1234", "Closes
#3456", "See also #7890".
More information
[here](https://github.com/blog/1506-closing-issues-via-pull-requests).
-->

`EstimatorReport.metrics.summarize()` no longer accepts arguments
`flat_index` or `favorability`. These have been moved to
`MetricsSummaryDisplay.frame()`.
This moves the responsibility of displaying things from
`EstimatorReport._MetricsAccessor` to `MetricsSummaryDisplay`.

```python
# Before
report.metrics.summarize(flat_index=True, favorability=True).frame()

# After
report.metrics.summarize().frame(flat_index=True, favorability=True)
```

This is a breaking change.

The rest of the PR consists in various refactorings, in particular the
tests have been updated to reflect the change in responsibility:
- Tests of `summarize()` were extracted from
`tests/unit/reports/estimator/metrics/test_numeric.py` to a new file,
`tests/unit/reports/estimator/metrics/test_summarize.py`.
- `test_summarize.py` now tests that `summarize()` behaves well, and
that the output of `summarize()` has a well-formed DataFrame. `.frame()`
is never called.
- `displays/metrics_summary/test_estimator.py` has been rewritten to
specifically test `.frame()` arguments.

A number of commits are included that could be pulled out into a
separate PR if needed.

Closes probabl-ai#2533
Supersedes probabl-ai#1839 in part

#### Contribution checklist
<!--
Below are some of the criteria that the review will include.
Feel free to use it as a checklist to ensure that your contribution is
high-quality.
-->

- [x] Unit tests were added or updated (if necessary)
- [x] Documentation was added or updated (if necessary)

#### AI usage disclosure
<!--
If AI tools were involved in creating this PR, please check all boxes
that apply
below and make sure you understand our [automated contributions
policy](https://docs.skore.probabl.ai/dev/contributing.html#automated-contributions-policy)
-->
AI tools were involved for:
- [ ] Code generation (e.g., when writing an implementation or fixing a
bug)
- [x] Test/benchmark generation
- [ ] Documentation (including examples)
- [ ] Research and understanding

In particular I used Claude to increase coverage.
<!-- Any other comments can go here. Thanks again for contributing! -->
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.

api(skore): Revisit the output of the .frame() from .summarize()

3 participants