Skip to content
Snippets Groups Projects
Commit 52f76ad1 authored by Jake VanderPlas's avatar Jake VanderPlas
Browse files

move ball_tree.pyx to scikits/learn/ and write pickle test

parent c3825e54
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
File moved
......@@ -44,7 +44,7 @@ def configuration(parent_package='', top_path=None):
warnings.warn(BlasNotFoundError.__doc__)
config.add_extension('ball_tree',
sources=[join('src', 'ball_tree.c')],
sources=['ball_tree.c'],
include_dirs=[numpy.get_include()])
# the following packages depend on cblas, so they have to be build
......
......@@ -256,6 +256,18 @@ def test_ball_tree_query_radius_distance(n_samples=100, n_features=10):
assert_array_almost_equal(d, dist)
def test_ball_tree_pickle():
import pickle
X = np.random.random(size=(10, 3))
bt = ball_tree.BallTree(X, 1)
s = pickle.dumps(bt)
bt2 = pickle.loads(s)
ind1, dist1 = bt.query(X)
ind2, dist2 = bt2.query(X)
assert_array_almost_equal(dist1, dist2)
if __name__ == '__main__':
import nose
nose.runmodule()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment