JakeColtman / bartpy

Bayesian Additive Regression Trees For Python
https://jakecoltman.github.io/bartpy/
MIT License
219 stars 44 forks source link

Questions about the calculation of likelihood ratio #66

Open lovelyshyperson opened 1 year ago

lovelyshyperson commented 1 year ago

Hello, Thank you for your contributions, which is a great help for me to understanding the BART model. But I found something questionable about the calculation of the likelihood ratio when sampling to modify the tree structure. Please take a look at the function log_grow_ratio in the file bartpy/samplers/unconstrainedtree/likelihoodratio.py, line 20

first_term = (var * (var + n * sigma_mu)) / ((var + n_l * var_mu) * (var + n_r * var_mu))

I think there are something wrong with n * sigma_mu. It should be corrected as first_term = (var * (var + n * var_mu)) / ((var + n_l * var_mu) * (var + n_r * var_mu))

Same question is also found in the log_grow_function in the file bartpy/samplers/oblivioustrees/likelihoodratio.py

My thoughts are based on the paper bartMachine: Machine Learning with Bayesian Additive Regression Tree, A.1. part. You will be greatly appreciated to point that out if I am wrong. Hope my thoughts be helpful to you.