probcomp / bdbcontrib

BayesDB contributions, including plotting, helper methods, and examples
http://probcomp.csail.mit.edu/bayesdb
Apache License 2.0
9 stars 6 forks source link

bdbcontrib.plot_utils.heatmap taking 180 times longer than in previous versions #138

Closed leocasarsa closed 8 years ago

leocasarsa commented 8 years ago

Updated version is taking longer

print bdbcontrib.__version__
Out: '0.1.7.post123+gc047b2c'

import time
import bdbcontrib.plot_utils as pu
start = time.time()
zmat = pu.heatmap(dep_probs, vmin=0, vmax=1)
end = time.time()
print end - start

Out: 356.713081121

Outdated version is way faster

print bdbcontrib.__version__
Out: '0.1.7.post117+g17b6962'

import timeit
import bdbcontrib.plot_utils as pu
start = time.time()
zmat = pu.heatmap(test, bdb, dep_probs)
end = time.time()
print end - start

Out: 2.36727905273
leocasarsa commented 8 years ago

Code in

probcomp-2: scratch/home/casarsa/Share/gusto/pilot/test_time_in_bayesdb.ipynb

gregory-marton commented 8 years ago

25da3a5 speeds things up a bit. May I ask you to try it on gusto, or should I?

leocasarsa commented 8 years ago

Now it's taking only four times longer, roughly.

venv: 20160505-headbdb

In:
import time
start = time.time()
q('''
    CREATE TABLE IF NOT EXISTS dep_probs AS
        ESTIMATE DEPENDENCE PROBABILITY FROM PAIRWISE
            COLUMNS OF %s
                ''' %(generator,))
​
dep_probs = q('''SELECT * from dep_probs''')
zmat = pu.heatmap(_, bdb, dep_probs)
end = time.time()
print "Plotting heatmap took ", end - start, "s"

Out: 
Plotting heatmap took  3.22220301628 s

venv: 20160516-headbdb

In:

import time
start = time.time()
q('''
    CREATE TABLE IF NOT EXISTS dep_probs AS
        ESTIMATE DEPENDENCE PROBABILITY FROM PAIRWISE
            COLUMNS OF %s
                ''' %(generator,))
​
dep_probs = q('''SELECT * from dep_probs''')
zmat = pu.heatmap(dep_probs)
end = time.time()
print "Plotting heatmap took ", end - start, "s"

Out:
Detected value limits as [0, 1]. Override with vmin and vmax.
Plotting heatmap took  11.8242058754 s
leocasarsa commented 8 years ago

12 s is not bad, so we might just close the issue. Still, I wanted to report the difference.

gregory-marton commented 8 years ago

Thanks! Yes, I think that's a reasonable slowdown for the extra work being done. I appreciate the followup!