class_docstr: Class for building, loading and working with Hierarchical Navigable Small World index with SciKit-Learn
  Estimator compatible interface.
  Mostly drop-in replacement for sklearn.neighbors.NearestNeighbors (except for some parameters)
class_docstr_tok: ["Class","for","building",",","loading","and","working","with","Hierarchical","Navigable","Small","World","index","with","SciKit-Learn","Estimator","compatible","interface",".","Mostly","drop-in","replacement","for","sklearn.neighbors.NearestNeighbors","(","except","for","some","parameters",")"]
docstr: Parameters
  ----------
  n_neighbors : int, default=5
      Number of neighbors to use by default for kneighbors queries.
  
  
  distance : EDistance
      Distance that should be used for finding nearest vectors.
  
  max_neighbors : int (default=32)
      Maximum number of neighbors that every item can be connected with.
  
  search_neighborhood_size : int (default=300)
      Search neighborhood size for ANN-search.
      Higher values improve search quality in expense of building time.
  
  num_exact_candidates : int (default=100)
      Number of nearest vectors to take from batch.
      Higher values improve search quality in expense of building time.
  
  batch_size : int (default=1000)
      Number of items that added to graph on each step of algorithm.
  
  upper_level_batch_size : int (default=40000)
      Batch size for building upper levels.
  
  level_size_decay : int (default=max_neighbors/2)
      Base of exponent for decaying level sizes.
docstr_tok: ["Parameters","--","--","--","--","--","n_neighbors",":","int",",","default=5","Number","of","neighbors","to","use","by","default","for","kneighbors","queries",".","distance",":","EDistance","Distance","that","should","be","used","for","finding","nearest","vectors",".","max_neighbors",":","int","(","default=32",")","Maximum","number","of","neighbors","that","every","item","can","be","connected","with",".","search_neighborhood_size",":","int","(","default=300",")","Search","neighborhood","size","for","ANN-search",".","Higher","values","improve","search","quality","in","expense","of","building","time",".","num_exact_candidates",":","int","(","default=100",")","Number","of","nearest","vectors","to","take","from","batch",".","Higher","values","improve","search","quality","in","expense","of","building","time",".","batch_size",":","int","(","default=1000",")","Number","of","items","that","added","to","graph","on","each","step","of","algorithm",".","upper_level_batch_size",":","int","(","default=40000",")","Batch","size","for","building","upper","levels",".","level_size_decay",":","int","(","default=max_neighbors\/2",")","Base","of","exponent","for","decaying","level","sizes","."]
code: def __init__(
      self,
      n_neighbors=5,
      distance=EDistance.DotProduct,
      max_neighbors=32,
      search_neighborhood_size=300,
      num_exact_candidates=100,
      batch_size=1000,
      upper_level_batch_size=40000,
      level_size_decay=None,
  ):
      """
      Parameters
      ----------
      n_neighbors : int, default=5
          Number of neighbors to use by default for kneighbors queries.
  
  
      distance : EDistance
          Distance that should be used for finding nearest vectors.
  
      max_neighbors : int (default=32)
          Maximum number of neighbors that every item can be connected with.
  
      search_neighborhood_size : int (default=300)
          Search neighborhood size for ANN-search.
          Higher values improve search quality in expense of building time.
  
      num_exact_candidates : int (default=100)
          Number of nearest vectors to take from batch.
          Higher values improve search quality in expense of building time.
  
      batch_size : int (default=1000)
          Number of items that added to graph on each step of algorithm.
  
      upper_level_batch_size : int (default=40000)
          Batch size for building upper levels.
  
      level_size_decay : int (default=max_neighbors/2)
          Base of exponent for decaying level sizes.
      """
      for key, value in iteritems(locals()):
          if key not in ["self", "__class__"]:
              setattr(self, key, value)
  
imports: import sys
  import os
  from six import iteritems
  from enum import IntEnum
  from contextlib import contextmanager
  import json
label_desc: Use image node_id 1 to create a new HnswEstimator object  with example: obj = HnswEstimator(n_neighbors, distance, max_neighbors, search_neighborhood_size, num_exact_candidates, batch_size, upper_level_batch_size, level_size_decay)