class_docstr: This class allows to use `NMSLIB <https://github.com/nmslib/nmslib>`_ as indexer for `most_similar` method
  from :class:`~gensim.models.word2vec.Word2Vec`, :class:`~gensim.models.doc2vec.Doc2Vec`,
  :class:`~gensim.models.fasttext.FastText` and :class:`~gensim.models.keyedvectors.Word2VecKeyedVectors` classes.
class_docstr_tok: ["This","class","allows","to","use","`","NMSLIB","<","https",":","\/\/github.com\/nmslib\/nmslib",">","`","_","as","indexer","for","`","most_similar","`","method","from",":","class",":","`","~gensim.models.word2vec.Word2Vec","`",",",":","class",":","`","~gensim.models.doc2vec.Doc2Vec","`",",",":","class",":","`","~gensim.models.fasttext.FastText","`","and",":","class",":","`","~gensim.models.keyedvectors.Word2VecKeyedVectors","`","classes","."]
docstr: Parameters
  ----------
  model : :class:`~gensim.models.base_any2vec.BaseWordEmbeddingsModel`
      Model, that will be used as source for index.
  index_params : dict, optional
      Indexing parameters passed through to NMSLIB:
      https://github.com/nmslib/nmslib/blob/master/manual/methods.md#graph-based-search-methods-sw-graph-and-hnsw
  
      If not specified, defaults to `{'M': 100, 'indexThreadQty': 1, 'efConstruction': 100, 'post': 0}`.
  query_time_params : dict, optional
      query_time_params for NMSLIB indexer.
      If not specified, defaults to `{'efSearch': 100}`.
docstr_tok: ["Parameters","--","--","--","--","--","model",":",":","class",":","`","~gensim.models.base_any2vec.BaseWordEmbeddingsModel","`","Model",",","that","will","be","used","as","source","for","index",".","index_params",":","dict",",","optional","Indexing","parameters","passed","through","to","NMSLIB",":","https",":","\/\/github.com\/nmslib\/nmslib\/blob\/master\/manual\/methods.md","#","graph-based-search-methods-sw-graph-and-hnsw","If","not","specified",",","defaults","to","`","{","'M","'",":","100",",","'indexThreadQty","'",":","1",",","'efConstruction","'",":","100",",","'post","'",":","0","}","`",".","query_time_params",":","dict",",","optional","query_time_params","for","NMSLIB","indexer",".","If","not","specified",",","defaults","to","`","{","'efSearch","'",":","100","}","`","."]
code: def __init__(self, model, index_params=None, query_time_params=None):
      """
      Parameters
      ----------
      model : :class:`~gensim.models.base_any2vec.BaseWordEmbeddingsModel`
          Model, that will be used as source for index.
      index_params : dict, optional
          Indexing parameters passed through to NMSLIB:
          https://github.com/nmslib/nmslib/blob/master/manual/methods.md#graph-based-search-methods-sw-graph-and-hnsw
  
          If not specified, defaults to `{'M': 100, 'indexThreadQty': 1, 'efConstruction': 100, 'post': 0}`.
      query_time_params : dict, optional
          query_time_params for NMSLIB indexer.
          If not specified, defaults to `{'efSearch': 100}`.
  
      """
      if index_params is None:
          index_params = {
              "M": 100,
              "indexThreadQty": 1,
              "efConstruction": 100,
              "post": 0,
          }
      if query_time_params is None:
          query_time_params = {"efSearch": 100}
  
      self.index = None
      self.labels = None
      self.model = model
      self.index_params = index_params
      self.query_time_params = query_time_params
  
      #
      # In the main use case, the user will pass us a non-None model, and we use that model
      # to initialize the index and labels.  In a separate (completely internal) use case, the
      # NsmlibIndexer.load function handles the index and label initialization separately,
      # so it passes us None as the model.
      #
      if model:
          if isinstance(self.model, Doc2Vec):
              self._build_from_doc2vec()
          elif isinstance(self.model, (Word2Vec, FastText)):
              self._build_from_word2vec()
          elif isinstance(self.model, (KeyedVectors,)):
              self._build_from_keyedvectors()
          else:
              raise ValueError(
                  "model must be a Word2Vec, Doc2Vec, FastText or KeyedVectors instance"
              )
  
file_path: gensim/gensim/similarities/nmslib.py
imports: from __future__ import absolute_import
  import pickle
  from smart_open import open
  from gensim import utils
  from gensim.models.doc2vec import Doc2Vec
  from gensim.models.word2vec import Word2Vec
  from gensim.models.fasttext import FastText
  from gensim.models import KeyedVectors
label_desc: Use image node_id 1 to create a new NmslibIndexer object  with example: obj = NmslibIndexer(model, index_params, query_time_params)