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.

arrowspace is a database for vectors supported by a graph representation and a key-value store. The main use-cases targeted are: AI search capabilities as advanced vector similarity, graph characterisation analysis and search, indexing of high-dimensional vectors. Design principles described in this article.

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[patchelf]
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.8.tar.gz (106.5 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.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

arrowspace-0.24.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

arrowspace-0.24.8-cp313-cp313-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

arrowspace-0.24.8-cp313-cp313-macosx_10_12_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

arrowspace-0.24.8-cp312-cp312-win_amd64.whl (4.1 MB view details)

Uploaded CPython 3.12Windows x86-64

arrowspace-0.24.8-cp312-cp312-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

arrowspace-0.24.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

arrowspace-0.24.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

arrowspace-0.24.8-cp312-cp312-macosx_11_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

arrowspace-0.24.8-cp312-cp312-macosx_10_12_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for arrowspace-0.24.8.tar.gz
Algorithm Hash digest
SHA256 0de2c54c8465af2107014a247e137f8fe725e9aa4e6c3b8cb8ceaa6bfc8da1f3
MD5 d574c0bf0224e0ab90ae4b6a08d8c2ac
BLAKE2b-256 d710fc87f050149b9390bb33d4dab1728686a2ddc0515df4cc87143564d6ca17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bd7afde44408507058c3949ee10cefe1bdc267b27d294c898392f77147e18aad
MD5 da63a4678b2e0d887cfb5129b4da119a
BLAKE2b-256 e4411e329f209806f0692cebab7b1a8eebebd2be8fbb1eddd9d4867e842b0a96

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 eea769c3adfcb39ab8c3913cfe0262ee2dafaf6465e3cc753d319c04dd9ade7e
MD5 3899c6fa9a79449d65f6e806d743ac73
BLAKE2b-256 4087c9280b1a2f3461f6398b3d151c6380ede33422bc9ed553d161286d89fca5

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 46dbd6e362e6cc2ef2437b449653aa9e6e2f88e6ead743ae408f117d7618bae8
MD5 a6e19b54875acad1706f720edcc8e67e
BLAKE2b-256 e901886963f21baf43e2e2c045f092a952e13dc901160a91e06a79227dff9af9

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 624c5a60cd13608a57f24fab0147b9ec44d8db19ee0e6cbb73bae4dceef8afbc
MD5 79b0deffd241ce7a24a76a3726f0fd4c
BLAKE2b-256 68fa4ebdfbec07aa4230f5eb2223bd625cc9624ab080f34c3456825e8734917a

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8b3a9e082e50d6fc6634ae60c376d1c5caf523fda363171190ba2796ef274e7f
MD5 2d5b8aaa7824acdc8e75159e3f4821e2
BLAKE2b-256 8b2cb93b4d869d197fdd1595913de9d6f19030275e0c6b8be10cc31bc8beab23

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ab649239f558bb1aae7a8e4ea1d91374152bc5805c78a968257c12ce420aac55
MD5 7c3fb218311b1b70d19e3fff7c489f04
BLAKE2b-256 92f6fe97e8b3eb57a8098b127b6bfb27c10b61b1f82382e43778e8649b3b81ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e2e515928fd933d586802dadcb0082fca633dbd0ffac3f2bdc48dc14fcd4b99
MD5 922c8ea0410ef4d7fcbe80302e237439
BLAKE2b-256 d8f4ff401f2bce00fcb5518c80a275421a3e14d98b13de06c3df53139eac4dd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 133bf84a9112fddaae6b43c430c25de1b72fd80f252ebf24652bde642a63b289
MD5 bff989744ccba6fe0478e2ca284274ab
BLAKE2b-256 2f6121fb68f13bf773ed0fea2ee93886114663bc52e37e27534d026ded061f38

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a81819c5b7bffaadadee56850e81c4dc5fc57d39362e7d395370ce0908e57e1e
MD5 3194ad1d7758cf4db34f1e061306037a
BLAKE2b-256 7cc6329e93403c886ee9d957a559deb398227378a2f925cb14ef9a4a28c85954

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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.8-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for arrowspace-0.24.8-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 458a920f33d830b0963331feb316865a1cac04583692531cb27f8e067e235fc5
MD5 1586e599b0aefa7dbae419d4924fa425
BLAKE2b-256 bd504869e6de0a89fe1b0000bde2d3e6d6f87ba0d6b6a73e810c2ae969477f7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for arrowspace-0.24.8-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