usearch 0.16.0 → 0.16.2
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.
- package/Cargo.toml +1 -1
- package/conanfile.py +1 -1
- package/package.json +1 -1
- package/python/usearch/eval.py +9 -6
package/Cargo.toml
CHANGED
package/conanfile.py
CHANGED
|
@@ -4,7 +4,7 @@ from conans import ConanFile
|
|
|
4
4
|
class USearchConan(ConanFile):
|
|
5
5
|
|
|
6
6
|
name = 'USearch'
|
|
7
|
-
version = '0.16.
|
|
7
|
+
version = '0.16.2'
|
|
8
8
|
license = 'Apache 2.0'
|
|
9
9
|
url = 'https://github.com/unum-cloud/usearch'
|
|
10
10
|
description = 'Smaller & Faster Single-File Vector Search Engine from Unum'
|
package/package.json
CHANGED
package/python/usearch/eval.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
1
|
from time import time_ns
|
|
3
2
|
from typing import Tuple, Any, Callable, Union, Optional, List
|
|
4
3
|
from dataclasses import dataclass, asdict
|
|
@@ -184,7 +183,7 @@ class TaskResult:
|
|
|
184
183
|
def search_seconds(self) -> float:
|
|
185
184
|
return self.search_operations / self.search_per_second
|
|
186
185
|
|
|
187
|
-
def __add__(self, other: TaskResult
|
|
186
|
+
def __add__(self, other: TaskResult):
|
|
188
187
|
result = TaskResult()
|
|
189
188
|
if self.add_operations and other.add_operations:
|
|
190
189
|
result.add_operations = self.add_operations + other.add_operations
|
|
@@ -246,7 +245,7 @@ class AddTask:
|
|
|
246
245
|
self.labels = self.labels[new_order]
|
|
247
246
|
self.vectors = self.vectors[new_order, :]
|
|
248
247
|
|
|
249
|
-
def slices(self, batch_size: int) ->
|
|
248
|
+
def slices(self, batch_size: int) -> list:
|
|
250
249
|
"""Splits this dataset into smaller chunks."""
|
|
251
250
|
|
|
252
251
|
return [
|
|
@@ -255,7 +254,7 @@ class AddTask:
|
|
|
255
254
|
vectors=self.vectors[start_row:start_row+batch_size, :],
|
|
256
255
|
) for start_row in range(0, self.count, batch_size)]
|
|
257
256
|
|
|
258
|
-
def clusters(self, number_of_clusters: int) ->
|
|
257
|
+
def clusters(self, number_of_clusters: int) -> list:
|
|
259
258
|
"""Splits this dataset into smaller chunks."""
|
|
260
259
|
|
|
261
260
|
from sklearn.cluster import KMeans
|
|
@@ -291,7 +290,7 @@ class SearchTask:
|
|
|
291
290
|
recall_at_one=results.recall_first(self.neighbors[:, 0].flatten()),
|
|
292
291
|
)
|
|
293
292
|
|
|
294
|
-
def slices(self, batch_size: int) ->
|
|
293
|
+
def slices(self, batch_size: int) -> list:
|
|
295
294
|
"""Splits this dataset into smaller chunks."""
|
|
296
295
|
|
|
297
296
|
return [
|
|
@@ -309,7 +308,11 @@ class Evaluation:
|
|
|
309
308
|
ndim: int
|
|
310
309
|
|
|
311
310
|
@staticmethod
|
|
312
|
-
def for_dataset(
|
|
311
|
+
def for_dataset(
|
|
312
|
+
dataset: Dataset,
|
|
313
|
+
batch_size: int = 0,
|
|
314
|
+
clusters: int = 1):
|
|
315
|
+
|
|
313
316
|
tasks = []
|
|
314
317
|
add = AddTask(
|
|
315
318
|
vectors=dataset.vectors,
|