Skip to content

knn: skipped items output when there is a skip function has always the last index and not 0 index #145

@lukeanto

Description

@lukeanto

Hello, I had old code written for Julia 1.0

using NearestNeighbors
data = [[0.13380863416387367, 0.7845254987714512],[0.1563342025559629, 0.7956456895676077],[0.23320094627474594, 0.9055515160266435]]
tree = KDTree(hcat(map(p -> [p[1], p[2]], data)...))
nearest, distance = knn(tree, [0.15, 0.8], 3, true, x -> x == 2)

In Julia 1.0, nearest is returned as [1, 3, 0], because 2 is skipped; in Julia 1.7.3, nearest is returned as [1, 3, 3], which seems not correct.

Packages status in Julia 1.0

  [15f4f7f2] AutoHashEquals v0.2.0
  [864edb3b] DataStructures v0.18.13
  [c27321d9] Glob v1.3.0
  [cd3eb016] HTTP v0.9.17
  [7073ff75] IJulia v1.23.3
  [6218d12a] ImageMagick v0.7.9
  [02fcd773] ImageTransformations v0.8.13
  [916415d5] Images v0.23.3
  [b8a86587] NearestNeighbors v0.4.10

Packages statuses in Julia 1.7.3:

  [15f4f7f2] AutoHashEquals v0.2.0
  [864edb3b] DataStructures v0.18.13
  [c27321d9] Glob v1.3.0
  [cd3eb016] HTTP v0.9.17
  [6218d12a] ImageMagick v1.2.1
  [02fcd773] ImageTransformations v0.9.4
  [916415d5] Images v0.25.2
  [b8a86587] NearestNeighbors v0.4.10

So they are the same, except for IJulia, which should not be significant anyway

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions