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.
The idea is to only compute the log-likelihood for the samples that fall into the tree instead of over all samples.
In
weight.rswe use a function pointer to a PyMC weight function and then call it withHowever, 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.