Skip to content

WIP: Add PSIS LFO-CV#305

Draft
TeemuSailynoja wants to merge 3 commits intoarviz-devs:mainfrom
TeemuSailynoja:psis-lfo-cv
Draft

WIP: Add PSIS LFO-CV#305
TeemuSailynoja wants to merge 3 commits intoarviz-devs:mainfrom
TeemuSailynoja:psis-lfo-cv

Conversation

@TeemuSailynoja
Copy link

This is a work in progress PR for adding approximate leave-future-out cross validation (LFO-CV) using pareto-smoothed importance sampling (PSIS).

The current implementation was planned by me and mostly implemented by Agentic assistance. I still need to personally go through it in detail.

  • Check computations in 9460737
  • Ensure all tests in 6dc74cb are needed and no gaps left
  • Make another branch for an example notebook to run a full case study to test that everything works as intended.

This PR is related to issue #177

Implements Leave-Future-Out Cross-Validation for time series models using
forward-mode validation with Pareto-Smoothed Importance Sampling (PSIS)
approximation to reduce computational cost. Supports both exact (always refit)
and approximate methods.

- lfo_cv.py: Main LFO-CV function with approx/exact methods
- helper_lfo_cv.py: Helper functions for input validation, step computation,
  and result combination
Exports lfo_cv at package level and adds LFO-CV support to compare()
function with proper validation to prevent comparing LFO-CV with
incompatible methods (LOO-CV, K-fold-CV).

- __init__.py files: Export lfo_cv function
- compare.py: Add LFO-CV validation in _calculate_ics
Adds mock SamplingWrapper fixtures for LFO-CV testing along with
comprehensive unit tests for main function and helper utilities.

- conftest.py: LFO-CV fixtures (data_with_time, mock_lfo_wrapper, etc.)
- test_lfo_cv.py: Unit tests for lfo_cv function
- test_helper_lfo_cv.py: Unit tests for helper functions
@TeemuSailynoja
Copy link
Author

@jordandeklerk I initiated a PR. I'm also very busy, but wanted to get past the "empty page" blocker and have a start for the PR :)

@read-the-docs-community
Copy link

Documentation build overview

📚 arviz-stats | 🛠️ Build #31551165 | 📁 Comparing 6dc74cb against latest (5d8858a)


🔍 Preview build

Show files changed (16 files in total): 📝 15 modified | ➕ 0 added | ➖ 1 deleted
File Status
genindex.html 📝 modified
api/index.html 📝 modified
_modules/arviz_stats/sampling_diagnostics.html 📝 modified
api/generated/arviz_stats.bfmi.html 📝 modified
api/generated/arviz_stats.diagnose.html ➖ deleted
api/generated/arviz_stats.ess.html 📝 modified
api/generated/arviz_stats.eti.html 📝 modified
api/generated/arviz_stats.hdi.html 📝 modified
api/generated/arviz_stats.histogram.html 📝 modified
api/generated/arviz_stats.kde.html 📝 modified
api/generated/arviz_stats.loo_kfold.html 📝 modified
api/generated/arviz_stats.mean.html 📝 modified
api/generated/arviz_stats.median.html 📝 modified
api/generated/arviz_stats.mode.html 📝 modified
api/generated/arviz_stats.qds.html 📝 modified
_modules/arviz_stats/loo/compare.html 📝 modified

@jordandeklerk
Copy link
Member

@jordandeklerk I initiated a PR. I'm also very busy, but wanted to get past the "empty page" blocker and have a start for the PR :)

Awesome, I will take a look soon!

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.

2 participants