Class: Hnswlib::HierarchicalNSW
- Inherits:
-
Object
- Object
- Hnswlib::HierarchicalNSW
- Defined in:
- ext/hnswlib/dummy.rb
Overview
HierarchicalNSW is a class that provides functions for approximate k-NN search. This class is used internally.
Instance Attribute Summary collapse
-
#space ⇒ L2Space | InnerProductSpace
readonly
Returns the metric space of search index.
Instance Method Summary collapse
-
#add_point(arr, idx, replace_deleted: false) ⇒ Boolean
Add item to be indexed.
-
#current_count ⇒ Integer
Return the number of items in the search index.
-
#get_ids ⇒ Array
Return the indices of stored items.
-
#get_point(idx) ⇒ Array
Return the item vector.
-
#init_index(max_elements:, m: 16, ef_construction: 200, random_seed: 100, allow_replace_deleted: false) ⇒ Nil
Intialize search index.
-
#initialize(space:, dim:) ⇒ HierarchicalNSW
constructor
Create a new HierarchicalNSW.
-
#load_index(filename, allow_replace_deleted: false) ⇒ Object
Load a search index from disk.
-
#mark_deleted(idx) ⇒ Object
Mark the item as deleted.
-
#max_elements ⇒ Integer
Return the maximum number of items.
-
#resize_index(new_max_item) ⇒ Object
Reize the search 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.
-
#set_ef(new_ef) ⇒ Object
Set the size of the dynamic list for the nearest neighbors.
Constructor Details
#initialize(space:, dim:) ⇒ HierarchicalNSW
Create a new HierarchicalNSW.
99 |
# File 'ext/hnswlib/dummy.rb', line 99 def initialize(space:, dim:); end |
Instance Attribute Details
#space ⇒ L2Space | InnerProductSpace (readonly)
Returns the metric space of search index.
93 94 95 |
# File 'ext/hnswlib/dummy.rb', line 93 def space @space end |
Instance Method Details
#add_point(arr, idx, replace_deleted: false) ⇒ Boolean
Add item to be indexed.
117 |
# File 'ext/hnswlib/dummy.rb', line 117 def add_point(arr, idx, replace_deleted: false); end |
#current_count ⇒ Integer
Return the number of items in the search index.
172 |
# File 'ext/hnswlib/dummy.rb', line 172 def current_count; end |
#get_ids ⇒ Array
Return the indices of stored items.
147 |
# File 'ext/hnswlib/dummy.rb', line 147 def get_ids; end |
#get_point(idx) ⇒ Array
Return the item vector.
142 |
# File 'ext/hnswlib/dummy.rb', line 142 def get_point(idx); end |
#init_index(max_elements:, m: 16, ef_construction: 200, random_seed: 100, allow_replace_deleted: false) ⇒ Nil
Intialize search index.
109 |
# File 'ext/hnswlib/dummy.rb', line 109 def init_index(max_elements:, m: 16, ef_construction: 200, random_seed: 100, allow_replace_deleted: false); end |
#load_index(filename, allow_replace_deleted: false) ⇒ Object
Load a search index from disk.
136 |
# File 'ext/hnswlib/dummy.rb', line 136 def load_index(filename, allow_replace_deleted: false); end |
#mark_deleted(idx) ⇒ Object
Mark the item as deleted.
152 |
# File 'ext/hnswlib/dummy.rb', line 152 def mark_deleted(idx); end |
#max_elements ⇒ Integer
Return the maximum number of items.
167 |
# File 'ext/hnswlib/dummy.rb', line 167 def max_elements; end |
#resize_index(new_max_item) ⇒ Object
Reize the search index.
157 |
# File 'ext/hnswlib/dummy.rb', line 157 def resize_index(new_max_item); end |
#save_index(filename) ⇒ Object
Save the search index to disk.
130 |
# File 'ext/hnswlib/dummy.rb', line 130 def save_index(filename); end |
#search_knn(arr, k, filter: nil) ⇒ Array<Array<Integer>, Array<Float>>
Search the k closest items.
125 |
# File 'ext/hnswlib/dummy.rb', line 125 def search_knn(arr, k, filter: nil); end |
#set_ef(new_ef) ⇒ Object
Set the size of the dynamic list for the nearest neighbors.
162 |
# File 'ext/hnswlib/dummy.rb', line 162 def set_ef(new_ef); end |