Skip to content
Snippets Groups Projects
Commit 0b3bee7b authored by Fabian Pedregosa's avatar Fabian Pedregosa
Browse files

neighbors squash

From: Fabian Pedregosa <fabian.pedregosa@inria.fr>

git-svn-id: https://scikit-learn.svn.sourceforge.net/svnroot/scikit-learn/trunk@555 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
parent 96ed447d
Branches
Tags
No related merge requests found
...@@ -39,13 +39,13 @@ def test_neighbors_2D(): ...@@ -39,13 +39,13 @@ def test_neighbors_2D():
Puts three points of each label in the plane and performs a Puts three points of each label in the plane and performs a
nearest neighbor query on points near the decision boundary. nearest neighbor query on points near the decision boundary.
""" """
samples = ( X = (
(0, 1), (1, 1), (1, 0), # label 0 (0, 1), (1, 1), (1, 0), # label 0
(-1,0), (-1,-1),(0,-1)) # label 1 (-1,0), (-1,-1),(0,-1)) # label 1
n_2 = len(samples)/2 n_2 = len(X)/2
labels = [0]*n_2 + [1]*n_2 Y = [0]*n_2 + [1]*n_2
knn = neighbors.Neighbors() knn = neighbors.Neighbors()
knn.fit(samples, labels) knn.fit(X, Y)
prediction = knn.predict(((0, .1), (0, -.1), (.1, 0), (-.1, 0))) prediction = knn.predict(((0, .1), (0, -.1), (.1, 0), (-.1, 0)))
assert_array_equal(prediction, ((0), (1), (0), (1))) assert_array_equal(prediction, ((0), (1), (0), (1)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment