arrowspace 0.24.7__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
arrowspace/__init__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: arrowspace
|
|
3
|
+
Version: 0.24.7
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Topic :: Database :: Front-Ends
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Rust
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Summary: Python bindings for ArrowSpace (Rust) providing graph-based similarity search, signal graphs, and spectral methods for vector data.
|
|
27
|
+
Keywords: vector-search,spectral-analysis,graph-signal,similarity-search,machine-learning
|
|
28
|
+
Home-Page: https://github.com/tuned-org-uk/pyarrowspace
|
|
29
|
+
License-Expression: MIT OR Apache-2.0
|
|
30
|
+
Requires-Python: >=3.12
|
|
31
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
32
|
+
Project-URL: Homepage, https://github.com/tuned-org-uk/pyarrowspace
|
|
33
|
+
Project-URL: Repository, https://github.com/tuned-org-uk/pyarrowspace.git
|
|
34
|
+
|
|
35
|
+
# pyarrowspace
|
|
36
|
+
|
|
37
|
+
Python bindings for [`arrowspace-rs`](https://github.com/Mec-iS/arrowspace-rs). This is experimental software meant for research at current state.
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
For labs and tests please see [tests/](https://github.com/tuned-org-uk/pyarrowspace/tree/main/tests)
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
From PyPi:
|
|
45
|
+
```
|
|
46
|
+
pip install arrowspace
|
|
47
|
+
```
|
|
48
|
+
or any other way of installing a Python library.
|
|
49
|
+
|
|
50
|
+
If you have cargo installed, to compile the libraries involved (from crates.io):
|
|
51
|
+
```
|
|
52
|
+
pip install maturin[patchelf]
|
|
53
|
+
maturin develop
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Tests
|
|
57
|
+
Simple test:
|
|
58
|
+
```
|
|
59
|
+
python tests/test_0.py
|
|
60
|
+
```
|
|
61
|
+
Test with public QA dataset:
|
|
62
|
+
```
|
|
63
|
+
python tests/test_1_quora_questions.py
|
|
64
|
+
```
|
|
65
|
+
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!
|
|
66
|
+
|
|
67
|
+
## Simplest Example
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from arrowspace import ArrowSpaceBuilder
|
|
71
|
+
import numpy as np
|
|
72
|
+
|
|
73
|
+
items: np.array = np.array(
|
|
74
|
+
[[0.1, 0.2, 0.3], [0.0, 0.5, 0.1], [0.9, 0.1, 0.0]],
|
|
75
|
+
dtype = np.float64
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
graph_params: dict = {
|
|
79
|
+
"eps": 1.0,
|
|
80
|
+
"k": 6,
|
|
81
|
+
"topk": 3,
|
|
82
|
+
"p": 2.0,
|
|
83
|
+
"sigma": 1.0,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
# Create an ArrowSpace instance, returning the computed
|
|
87
|
+
# signal graph and lambdas
|
|
88
|
+
aspace, gl = ArrowSpaceBuilder.build(graph_params, items)
|
|
89
|
+
|
|
90
|
+
# Search comparable items
|
|
91
|
+
# defaults: k = nitems, alpha = 0.9, beta = 0.1
|
|
92
|
+
query: np.array = np.array(
|
|
93
|
+
[0.05, 0.2, 0.25],
|
|
94
|
+
dtype = np.float64
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
tau: float = 1.0
|
|
98
|
+
hits: list = aspace.search(query, gl, tau)
|
|
99
|
+
|
|
100
|
+
# Search returns a list of `(index, score`) tuples, where
|
|
101
|
+
# expected value from the code above show the first index
|
|
102
|
+
# having the top score, i.e., being nearest.
|
|
103
|
+
|
|
104
|
+
print(hits)
|
|
105
|
+
# [ (0, 0.989743318610787), (1, 0.7565344158360029), (2, 0.22151940739207396) ]
|
|
106
|
+
```
|
|
107
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
arrowspace/__init__.py,sha256=jspivnl2iF9Hv5mFfJCt-SsKYyP2J5blPMb4EJ3paWY,123
|
|
2
|
+
arrowspace/arrowspace.cpython-312-aarch64-linux-gnu.so,sha256=3iM6IrulPUm6ckDFKlRKjaInCWq8SjfOq47rqTjbtYw,14424816
|
|
3
|
+
arrowspace-0.24.7.dist-info/METADATA,sha256=D3Hda3oFDVoqjyauSVi17yTxZDhrQzGVPvWH6Vt_-hg,3700
|
|
4
|
+
arrowspace-0.24.7.dist-info/WHEEL,sha256=KcEHwgAOZpA9KJU2GQ8nSDlv3GY4rKutl6LoPPnipro,149
|
|
5
|
+
arrowspace-0.24.7.dist-info/licenses/LICENSE,sha256=WvNgHrGIDgEKWptL6-w8Gf1PTNBHPManklmdOk_dnF4,592
|
|
6
|
+
arrowspace-0.24.7.dist-info/RECORD,,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright [2025] tuned.org.uk, Mec-iS
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|