Class: Hnswlib::BruteforceSearch
- Inherits:
-
Object
- Object
- Hnswlib::BruteforceSearch
- Defined in:
- ext/hnswlib/dummy.rb
Overview
BruteforceSearch is a class that provides functions for exct k-NN search. This class is useful for evaluating the search accuracy and investigating the optimal hyperparameters of HierarchicalNSW.
Instance Attribute Summary collapse
-
#space ⇒ L2Space | InnerProductSpace
readonly
Returns the metric space of search index.
Instance Method Summary collapse
-
#add_point(arr, idx) ⇒ Boolean
Add item to be indexed.
-
#current_count ⇒ Integer
Return the number of items in the search index.
-
#init_index(max_elements:) ⇒ Nil
Initialize search index.
-
#initialize(space:) ⇒ BruteforceSearch
constructor
Create a new BruteforceSearch.
-
#load_index(filename) ⇒ Object
Load a search index from disk.
-
#max_elements ⇒ Integer
Return the maximum number of items.
-
#remove_point(idx) ⇒ Object
Remove the item from index.
-
#save_index(filename) ⇒ Object
Save the search index to disk.
-
#search_knn(arr, k, filter: nil) ⇒ Array<Array<Integer>, Array<Float>>
Search the k closest items.
Constructor Details
#initialize(space:) ⇒ BruteforceSearch
Create a new BruteforceSearch.
202 |
# File 'ext/hnswlib/dummy.rb', line 202 def initialize(space:); end |
Instance Attribute Details
#space ⇒ L2Space | InnerProductSpace (readonly)
Returns the metric space of search index.
197 198 199 |
# File 'ext/hnswlib/dummy.rb', line 197 def space @space end |
Instance Method Details
#add_point(arr, idx) ⇒ Boolean
Add item to be indexed.
215 |
# File 'ext/hnswlib/dummy.rb', line 215 def add_point(arr, idx); end |
#current_count ⇒ Integer
Return the number of items in the search index.
248 |
# File 'ext/hnswlib/dummy.rb', line 248 def current_count; end |
#init_index(max_elements:) ⇒ Nil
Initialize search index.
208 |
# File 'ext/hnswlib/dummy.rb', line 208 def init_index(max_elements:); end |
#load_index(filename) ⇒ Object
Load a search index from disk.
233 |
# File 'ext/hnswlib/dummy.rb', line 233 def load_index(filename); end |
#max_elements ⇒ Integer
Return the maximum number of items.
243 |
# File 'ext/hnswlib/dummy.rb', line 243 def max_elements; end |
#remove_point(idx) ⇒ Object
Remove the item from index.
238 |
# File 'ext/hnswlib/dummy.rb', line 238 def remove_point(idx); end |
#save_index(filename) ⇒ Object
Save the search index to disk.
228 |
# File 'ext/hnswlib/dummy.rb', line 228 def save_index(filename); end |
#search_knn(arr, k, filter: nil) ⇒ Array<Array<Integer>, Array<Float>>
Search the k closest items.
223 |
# File 'ext/hnswlib/dummy.rb', line 223 def search_knn(arr, k, filter: nil); end |