Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about using knn.radius_neighbors #21

Open
YaokaiYang-assaultmaster opened this issue Feb 1, 2018 · 1 comment
Open

Question about using knn.radius_neighbors #21

YaokaiYang-assaultmaster opened this issue Feb 1, 2018 · 1 comment

Comments

@YaokaiYang-assaultmaster

Hi Daniel:

Thank you very much for reading this. This is not quite an issue but a question. I found you are passing a list as radius to knn.radius_neighbors function while I cannot find any documentation about it.

Doc of this function only said that it accepts a float as radius. Can you please help me to understand this code?

# find the distance of the kth in-class point
    for c in classes:
        mask = np.where(y == c)[0]
        knn.fit(x[mask, :])
        d2k[mask] = knn.kneighbors()[0][:, -1]

    # find the number of points within the distance of the kth in-class point
    knn.fit(x)
    m = knn.radius_neighbors(radius=d2k, return_distance=False)
    m = [i.shape[0] for i in m]

Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants