joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
347 stars 76 forks source link

various ellipsoid speedups #239

Closed segasai closed 3 years ago

segasai commented 3 years ago

tensordot is not needed

segasai commented 3 years ago

This set of commits speeds up various ellipsoid things. The effective speedup of update() with bootstrap is ~ 20%. The test is below

import time
import numpy as np

np.random.seed(1)

points = np.random.normal(size=(100, 10))
e0 = db.Ellipsoid(np.ones(10), np.eye(10))
e1 = db.MultiEllipsoid([e0])
t1 = time.time()
for i in range(1000):
    e1.update(points, bootstrap=10)
t2 = time.time()
print(t2 - t1)

I also bit the bullet and ran bounding through yapf, to avoid occasional whitespace changes in the future (when I edit the code is automatically yapf it)

joshspeagle commented 3 years ago

Are these changes ~stable enough now that I should start to look over this PR for merging in?

segasai commented 3 years ago

Yes, It' stable. It also has fixes to the likelihood saving (which broke pool functionality in the main branch).

segasai commented 3 years ago

Did you have a chance of looking at this to merge ? I don't want to start changing other things before this is merged, due to potential conflicts.

joshspeagle commented 3 years ago

No, sorry -- it's been a crazy busy week on my end. It's on the top of my to-do list, so I plan to do it by the end of the night (Eastern time) at the latest. Sorry about the delay.

segasai commented 3 years ago

Thanks!