stan-dev / stan-dev/loo

Feature Request: public subset() method for psis objects

Open
#343 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
157
Forks
38
Avg merge
4d 16h
Merged PRs (30d)
2

Description

There is currently no public API in the loo package to subset a psis object by observation index. Downstream packages that need this functionality are forced to manually manipulate the internal structure of psis objects.

For example, bayesplot has had this workaround sitting with a FIXME comment : https://github.com/stan-dev/bayesplot/blob/master/R/ppc-loo.R#L722-L738

Would it be possible to export a subset.psis() S3 method or a subset_psis() helper? That way downstream code can drop the fragile workaround and rely on a stable API.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the workaround in bayesplot's R/ppc-loo.R at lines 722-738, then inspect how the loo package represents psis objects and exposes related APIs. Done means downstream code can subset a psis object by observation index through a stable public method or helper instead of manipulating its internals.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.