jmschrei / pomegranate

Fast, flexible and easy to use probabilistic modelling in Python.
http://pomegranate.readthedocs.org/en/latest/
MIT License
3.29k stars 591 forks source link

Threading -> multiprocessing for Bayesian Network #978

Closed joy13975 closed 2 years ago

joy13975 commented 2 years ago

For issue #962. Switch parallelism backend to multiprocessing, and fix the passing of kwargs for log_probability() and predict_proba().

The following has succeeded:

python -m build
python setup.py test

Test environment:

EC2 Amazon Linux (m5.2xlarge) Python 3.8.8 (Cython) pomegranate 0.14.8

Performance check (5,236 test instances):

m = max_iterations n = n_jobs

m\n 1 2 4
1 125s 75s 60s
5 869s 461s 241s
dolevamir commented 2 years ago

I've modified the function using this code and it works great for my usecase