Skip to main content

Python bindings for ArrowSpace (Rust) providing graph-based similarity search, signal graphs, and spectral methods for vector data.

Project description

pyarrowspace

Python bindings for arrowspace-rs. This is experimental software meant for research at current state.

This is the starting repository for arrowspace, it is made public as a showcase for the Python interface, to collect feedback and make public some results of the tests run. To run needs the arrowspace-rs Rust module in a sibling directory.

For labs and tests please see tests/

Installation

From PyPi:

pip install arrowspace

or any other way of installing a Python library.

If you have cargo installed, to compile the libraries involved (from crates.io):

pip install maturin
maturin develop

Tests

Simple test:

python tests/test_0.py

Test with public QA dataset:

python tests/test_1_quora_questions.py

There are other tests but they require downloadin a dataset separately or fine-tuning the embeddings on a given dataset. Give it a try and let me know!

Simplest Example

from arrowspace import ArrowSpaceBuilder
import numpy as np

items: np.array = np.array(
    [[0.1, 0.2, 0.3], [0.0, 0.5, 0.1], [0.9, 0.1, 0.0]],
    dtype = np.float64
)

graph_params: dict = {
    "eps": 1.0,
    "k": 6,
    "topk": 3,
    "p": 2.0,
    "sigma": 1.0,
}

# Create an ArrowSpace instance, returning the computed
# signal graph and lambdas
aspace, gl = ArrowSpaceBuilder.build(graph_params, items)

# Search comparable items
# defaults: k = nitems, alpha = 0.9, beta = 0.1
query: np.array = np.array(
    [0.05, 0.2, 0.25],
    dtype = np.float64
)

tau: float = 1.0
hits: list = aspace.search(query, gl, tau)

# Search returns a list of `(index, score`) tuples, where
# expected value from the code above show the first index
# having the top score, i.e., being nearest.

print(hits)
# [ (0, 0.989743318610787), (1, 0.7565344158360029), (2, 0.22151940739207396) ]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arrowspace-0.24.0.tar.gz (69.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

arrowspace-0.24.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (953.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

arrowspace-0.24.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (893.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

arrowspace-0.24.0-cp313-cp313-macosx_11_0_arm64.whl (816.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

arrowspace-0.24.0-cp313-cp313-macosx_10_12_x86_64.whl (856.2 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

arrowspace-0.24.0-cp312-cp312-win_amd64.whl (734.9 kB view details)

Uploaded CPython 3.12Windows x86-64

arrowspace-0.24.0-cp312-cp312-manylinux_2_34_x86_64.whl (789.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

arrowspace-0.24.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (953.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

arrowspace-0.24.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (895.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

arrowspace-0.24.0-cp312-cp312-macosx_11_0_arm64.whl (816.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

arrowspace-0.24.0-cp312-cp312-macosx_10_12_x86_64.whl (856.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file arrowspace-0.24.0.tar.gz.

File metadata

  • Download URL: arrowspace-0.24.0.tar.gz
  • Upload date:
  • Size: 69.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.4

File hashes

Hashes for arrowspace-0.24.0.tar.gz
Algorithm Hash digest
SHA256 9f283d399a1fb31d438facb9a34811e76ed71e4e905016d8cf3976d9f27c2b19
MD5 9367be6273d65e7482228d567af77dcf
BLAKE2b-256 fd37350cda5fd241013641c40ca426d0748b0eb72943d5fa147315de5b07f5dd

See more details on using hashes here.

File details

Details for the file arrowspace-0.24.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b3515d99444c418f46baadaa5715a87316f6917d736dce34e01e2a12173ebb8
MD5 7e4b245b8239cb2d4b01356b732fa35e
BLAKE2b-256 b2f0694ad1662b6f6001cc98d1544e3dc0204fb2f5e8487b866a6a238782f1de

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8357a874911eb7345d29aa926dca7f65d1837f47b1bf510b1e5c75cb1b0e3bee
MD5 cd15e08801407b324470abb5ef6db86f
BLAKE2b-256 5a1e044de5ed6b99fd4bbddfaf4f3d4edc05c1872354b25d6088f2ced4437582

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a407246882f7e2c439260d6375fbc27c5f45ef1fad0e1200d730a5cc13c9007e
MD5 182719d17c632e6321375f65c54baa0b
BLAKE2b-256 e62598e76ea984fe02ae7f0dffb68e3f49f2f6c0e020af5106192f35f560143e

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c8bb4d092b197df1252dd9621db84764072088b6b2d65e348c256704969846ed
MD5 1b7487adbb371a8fbd2e1418febb000f
BLAKE2b-256 c3b4496b0518fc36317991ffbb0173d538a10e222621b518b566780cfc25e824

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: arrowspace-0.24.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 734.9 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for arrowspace-0.24.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a669ee6f1180c2a98493341e123898a2c6f982fe0a1d091097a45b781d8f16af
MD5 4e839bfc7d7730155d6e722145cc5c66
BLAKE2b-256 ab12c3e2381944d83817777e4c7d2c900b0ee7f87fe9c1b7476f8645f74f52ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp312-cp312-win_amd64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 47091be0fa9e66dc612c9e091368c624bbf9c15e4cd6fcfdf874921f0f7a29c7
MD5 8d98b19e287c4a4da842c761b7aa9066
BLAKE2b-256 868ad1e3b64290c21d5ae3c3254680c3c77ff277b024582579436a830a4e0cb8

See more details on using hashes here.

File details

Details for the file arrowspace-0.24.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 01d1bf0c7508ea5c9d532dcee16f49cdc4b990aac97b48c47866d850fb660483
MD5 dab03b4a85084946c2bb845adf4c27b7
BLAKE2b-256 c0081443bc5eb9693d168dcbb5df746d2864daa60f331cbd089f634509d3d436

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b4e0493ea783cd7403d5f34116169c51c1f7f6dbd033c0a2da4561a4d26c1917
MD5 d6ce22cbf4600a5dfc7e396b4c88ec86
BLAKE2b-256 77695d036afc9901f9480e18a5363a3ee4ab9db9fb7ddd66b96c20e738ef2fe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f30ffcbe268ccab6ddf5d3d0e229be2b546016b6416bb62227a94dea1b762928
MD5 1dc79f9ad851bc2d9aa2faa4c195de81
BLAKE2b-256 db0904a3165c90500af50cccf323bc4b1f1fa6b26eb374925da47c08ea02545a

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arrowspace-0.24.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7f28ad2153ded368ff90edbdb9dd030bf9d53a5636092896a59c07000b5c720c
MD5 5ff65d5094df79c7f28102b71a522587
BLAKE2b-256 8cc7087df6d275c0d9db81958a107ea65b9f22578f6319a36379d79fff4ab80d

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: python-publish.yml on tuned-org-uk/pyarrowspace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page