¡@

Home 

python Programming Glossary: t0

Why is SQLAlchemy insert with sqlite 25 times slower than using sqlite3 directly?

http://stackoverflow.com/questions/11769366/why-is-sqlalchemy-insert-with-sqlite-25-times-slower-than-using-sqlite3-directly

engine def test_sqlalchemy n 100000 init_sqlalchemy t0 time.time for i in range n customer Customer customer.name 'NAME.. SqlAlchemy Total time for str n records str time.time t0 secs def init_sqlite3 dbname conn sqlite3.connect dbname c conn.cursor.. dbname 'sqlite3.db' conn init_sqlite3 dbname c conn.cursor t0 time.time for i in range n row 'NAME ' str i c.execute INSERT..

more efficient way to calculate distance in numpy?

http://stackoverflow.com/questions/17527340/more-efficient-way-to-calculate-distance-in-numpy

in numpy as fast as it can def getR1 VVm VVs HHm HHs t0 time.time R VVs.flatten numpy.newaxis VVm.flatten numpy.newaxis.. numpy.newaxis R1 R1 R R1 del R1 print R1 t time.time t0 R.shape #11.7576191425 108225 10500 print numpy.max R #4176.26290975.. # uses 17.5Gb ram return R def getR2 VVm VVs HHm HHs t0 time.time precomputed_flat numpy.column_stack VVs.flatten HHs.flatten..

Is it possible to specify your own distance function using Scikits.Learn K-Means Clustering?

http://stackoverflow.com/questions/5529625/is-it-possible-to-specify-your-own-distance-function-using-scikits-learn-k-means

size N dim # cf scikits learn datasets t0 time if kmsample 0 centres xtoc dist kmeanssample X ncluster.. maxiter kmiter metric metric verbose 2 print .0f msec time t0 1000 # also ~ py np kmeans test kmeans.py Some notes added 26mar..