Skip to content

Commit

Permalink
Implemented Ball Tree using Haversine distance as mentioned in abstra…
Browse files Browse the repository at this point in the history
…ctqqq#237

Thie implmentation does not utilize the SpatialQueries Trait. But can
be modified after somce discussion on how to handle the differeing
parameters
This does implement all the function utilized in the query_knn.py
There is demo code at the botton of basics.ipynb

There are also some Rust tests to test the functioning of the ball tree.
This ball tree was influenced by [this repo](https://github.com/grantslatton/ball-tree).
  • Loading branch information
Anant committed Sep 21, 2024
1 parent a5db600 commit 686ee21
Show file tree
Hide file tree
Showing 8 changed files with 2,551 additions and 248 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ crate-type = ["cdylib"]
[dependencies]
pyo3 = {version = "*", features = ["abi3-py38", "extension-module"]}
pyo3-polars = {version = "0.15", features = ["derive"]}
polars = {version = "0.41.3", features = ["performant", "cse", "lazy", "parquet", "dtype-array", "diff", "array_count", "abs", "cross_join", "rank", "ndarray", "log", "cum_agg", "round_series", "nightly"]}
polars = {version = "0.41.3", features = ["performant", "cse", "lazy",
"parquet", "dtype-array", "diff", "array_count", "abs", "cross_join", "rank", "ndarray", "log",
"cum_agg", "round_series", "nightly", "dtype-struct"]}
num = "0.4.1"
faer = {version = "0.19", features = ["nightly"]}
faer-ext = {version = "0.2.0", features = ["ndarray"]}
Expand Down Expand Up @@ -43,3 +45,8 @@ jemallocator = { version = "0.5", features = ["disable_initial_exec_tls"] }
codegen-units = 1
strip = "symbols"
# lto = "fat"


[dev-dependencies]
rand = "0.8"
rand_chacha = "0.3"
996 changes: 750 additions & 246 deletions examples/basics.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions python/polars_ds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from polars_ds.features import * # noqa: F403
from polars_ds.query_knn import * # noqa: F403
from polars_ds.query_linear import * # noqa: F403
from polars_ds.query_balltree import * # noqa: F403


__version__ = "0.6.0"
Expand Down
Loading

0 comments on commit 686ee21

Please sign in to comment.