bayesmix-dev / bayesmix

Flexible Bayesian nonparametric mixture models in C++
https://bayesmix.rtfd.io
BSD 3-Clause "New" or "Revised" License
22 stars 18 forks source link

De-serializing chains in Python #149

Closed mberaha closed 9 months ago

mberaha commented 10 months ago

This PR introduces a way to load the whole MCMC chain in Python using the bayesmixpy interface. Specifically

  1. In the main CMakeLists.txt file, in addition to compiling the CPP photos, we compile also the Python ones. However, protoc compiles to Python2 (welcome to 2001)
  2. In build_bayesmix we call 2to3 (now added to the requirements) to convert the compiled proto files into Python3. Might not be super pretty but it's effective
  3. in run_mcmc we add an option return_chains which is by default False, if True these will be read from file using io_utils.read_many_protos_from_file.
mberaha commented 9 months ago

Also, what's up with the CodeFactor tests failing? Can we fix that?

Apparently the function run_mcmc has too many arguments and CodeFactor is complaining that it is a complex method. I would not worry about it

mberaha commented 9 months ago

This should be ready to go. It would be great if you could run a quick test and clean all the build and lib/_deps folder, install bayesmixpy and run build_bayesmix() as a final check.