This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from benchy.api import Benchmark, BenchmarkSuite, BenchmarkRunner | |
import matplotlib.pyplot as plt | |
common_setup = """ | |
import numpy | |
X = numpy.random.uniform(1,5,(1000,)) | |
""" | |
statement = "cosine_distances(X, X)" | |
setup_bk1 = common_setup + """ | |
import scipy.spatial.distance as ssd | |
X = X.reshape(-1,1) | |
def cosine_distances(X, Y): | |
return 1. - ssd.cdist(X, Y, 'cosine') | |
""" | |
benchmark1 = Benchmark(statement, setup_bk1, name="scipy.spatial 0.8.0") | |
results = benchmark1.run() | |
print benchmark1.to_rst(results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment