Closed erkghlerngm44 closed 7 years ago
import timeit a = [1,1,2,4,4,2,6,3,5,3,6,8,5,9,3,1,5,1,8,3,7,4,7,3,7,2,8,8,9,9,9,6,5,3,2] b = [6,4,7,9,3,1,5,2,7,3,8,4,9,1,2,4,8,5,2,1,2,8,2,9,1,2,4,6,3,5,6,8,4,2,1] timeit.timeit("malaffinity.calcs.pearson(a, b)", setup="import malaffinity; from __main__ import a, b", number=100) # 1.3594748531468213 timeit.timeit("scipy.asscalar(scipy.stats.pearsonr(a, b)[0])", setup="import scipy, scipy.stats; from __main__ import a, b", number=100) # 0.006378829013556242
Pretty big difference, and it's really noticeable when you're calculating affinity with thousands of people.
Options:
malaffinity.calcs.pearson
scipy
Pretty big difference, and it's really noticeable when you're calculating affinity with thousands of people.
Options:
malaffinity.calcs.pearson
faster by rewriting it.scipy
and use that?