hnswlib 0.2.0 → 0.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/hnswlib.rb +6 -3
- data/lib/hnswlib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7823039ef0a73f79011cbbb4dd8bb90f56549d82c93cee311725a2e728ab8809
|
4
|
+
data.tar.gz: be1846136d1d87c63d3aa49c404f9148c8d04d8c0ba4af65d6297096b5683150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ddd709e8bd403b959c7ab8bc21b17b6e264da0976a2d85a4acd7edeb057b7771d53fac337d3a6dfdd2718dcd499efd2b0f8633170241dd01269cd34753be10a
|
7
|
+
data.tar.gz: 11fd6ee5ca94949665fa30a106e926283c9e190030b47b6b001b0fd755ff5512f8b913b02bb79f1b51cb851c50867d0dca1a861fb2f09b6805e4d0b74bb033b5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## [0.3.0] - 2021-08-08
|
2
|
+
|
3
|
+
- Rename `Hnswlib::Index` to `Hnswlib::HnswIndex` (for compatibility, `Hnswlib::Index` has been an alis for `Hnswlib::HnswIndex`).
|
4
|
+
- Update API documentation.
|
5
|
+
|
1
6
|
## [0.2.0] - 2021-08-02
|
2
7
|
|
3
8
|
- Add binding class for the BruteforceSearch.
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ Or install it yourself as:
|
|
35
35
|
require 'hnswlib'
|
36
36
|
|
37
37
|
f = 40 # length of item vector that will be indexed.
|
38
|
-
t = Hnswlib::
|
38
|
+
t = Hnswlib::HnswIndex.new(n_features: f, max_item: 1000)
|
39
39
|
|
40
40
|
1000.times do |i|
|
41
41
|
v = Array.new(f) { rand }
|
@@ -44,7 +44,7 @@ end
|
|
44
44
|
|
45
45
|
t.save('test.ann')
|
46
46
|
|
47
|
-
u = Hnswlib::
|
47
|
+
u = Hnswlib::HnswIndex.new(n_features: f, max_item: 1000)
|
48
48
|
u.load('test.ann')
|
49
49
|
p u.get_nns_by_item(0, 100) # will find the 100 nearest neighbors.
|
50
50
|
```
|
data/lib/hnswlib.rb
CHANGED
@@ -4,12 +4,12 @@ require_relative 'hnswlib/version'
|
|
4
4
|
require_relative 'hnswlib/hnswlibext'
|
5
5
|
|
6
6
|
module Hnswlib
|
7
|
-
#
|
7
|
+
# HnswIndex is a class that provides functions for k-nearest eighbors search.
|
8
8
|
#
|
9
9
|
# @example
|
10
10
|
# require 'hnswlib'
|
11
11
|
#
|
12
|
-
# index = Hnswlib::
|
12
|
+
# index = Hnswlib::HnswIndex.new(n_features: 100, max_item: 10000)
|
13
13
|
#
|
14
14
|
# 5000.times do |item_id|
|
15
15
|
# item_vec = Array.new(100) { rand - 0.5 }
|
@@ -18,7 +18,7 @@ module Hnswlib
|
|
18
18
|
#
|
19
19
|
# index.get_nns_by_item(0, 100)
|
20
20
|
#
|
21
|
-
class
|
21
|
+
class HnswIndex
|
22
22
|
# Returns the metric of index.
|
23
23
|
# @return [String]
|
24
24
|
attr_reader :metric
|
@@ -150,4 +150,7 @@ module Hnswlib
|
|
150
150
|
@index.max_elements
|
151
151
|
end
|
152
152
|
end
|
153
|
+
|
154
|
+
# Index is alias of HnswIndex
|
155
|
+
Index = ::Hnswlib::HnswIndex
|
153
156
|
end
|
data/lib/hnswlib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hnswlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Hnswlib.rb provides Ruby bindings for the Hnswlib.
|
14
14
|
email:
|