pymc-devs / pymc-devs/bartrs

Compute log-likelihood for less samples

Open
#17 0 comments 0 reactions 1 assignee View on GitHub

@OttoVintola is already working on this.

Since Jun 13, 2026.

  • #18 by @OttoVintola — closed without merging
  • #19 by @OttoVintola — open
enhancement
Dominant language
Rust
Stars
8
Forks
1
PR merge metrics
No merged PRs in 30d

Description

The idea is to only compute the log-likelihood for the samples that fall into the tree instead of over all samples.

In weight.rs we use a function pointer to a PyMC weight function and then call it with

    fn log_weight(&self, predictions: &[f64]) -> f64 {
        unsafe { (self.func_ptr)(predictions.as_ptr(), predictions.len()) }
    }

However, the log likelihood of the samples that are not assigned to the mutated tree during SMC, remain the same from the previous iteration. Thus, they are being computed for no reason again.

According to the PyTensor folks, a solution could be to use a subtensor lift in from PyTensor.

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.