Skip to content

Rework the metric interface and collection to use explicit accumulators - #1063

Merged
mdekstrand merged 19 commits into
lenskit:mainfrom
mdekstrand:feature/866-accumulators
Apr 6, 2026
Merged

Rework the metric interface and collection to use explicit accumulators#1063
mdekstrand merged 19 commits into
lenskit:mainfrom
mdekstrand:feature/866-accumulators

Conversation

@mdekstrand

@mdekstrand mdekstrand commented Apr 5, 2026

Copy link
Copy Markdown
Member

This overhauls the metric interface and the metric collection code to use explicit accumulator objects, so different metrics can have different accumulation behavior, and allowing things like Gini to be computed with less memory consumption.

It also simplifies and deprecates RunAnalysis in favor of directly using MeasurementCollector.

Several of the old MeasurementCollector tests are removed because the measurement collector is responsible for much less logic now.

Closes #866, #968.

@mdekstrand mdekstrand added this to the 2026.1 milestone Apr 5, 2026
@mdekstrand
mdekstrand requested a review from sushobhan2024 April 5, 2026 18:26
@mdekstrand mdekstrand self-assigned this Apr 5, 2026
@codecov

codecov Bot commented Apr 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.43028% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.49%. Comparing base (ab4c43e) to head (8d71a1b).
⚠️ Report is 23 commits behind head on main.

Files with missing lines Patch % Lines
src/lenskit/data/accum/_object.py 0.00% 11 Missing ⚠️
src/lenskit/metrics/_collect.py 96.20% 3 Missing ⚠️
src/lenskit/data/accum/_value.py 93.33% 2 Missing ⚠️
src/lenskit/metrics/bulk.py 87.50% 2 Missing ⚠️
src/lenskit/metrics/ranking/_gini.py 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1063      +/-   ##
==========================================
- Coverage   89.54%   89.49%   -0.05%     
==========================================
  Files         229      233       +4     
  Lines       15870    15890      +20     
==========================================
+ Hits        14210    14220      +10     
- Misses       1660     1670      +10     

☔ View full report in Codecov by Sentry.
📢 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.

@mdekstrand mdekstrand linked an issue Apr 5, 2026 that may be closed by this pull request
@mdekstrand
mdekstrand marked this pull request as ready for review April 5, 2026 19:35
@mdekstrand
mdekstrand force-pushed the feature/866-accumulators branch from 4bb57c9 to 44cd728 Compare April 5, 2026 19:48
@mdekstrand
mdekstrand merged commit b148ed0 into lenskit:main Apr 6, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Metric interface to return None for no-value Add explicit metric accumulation support

1 participant