class_docstr: Speeds up inference calls to MatrixFactorization models by using
  `NMSLib <https://github.com/nmslib/nmslib>`_ to create approximate nearest neighbours
  indices of the latent factors.
  
  Parameters
  ----------
  model : MatrixFactorizationBase
      A matrix factorization model to use for the factors
  method : str, optional
      The NMSLib method to use
  index_params: dict, optional
      Optional params to send to the createIndex call in NMSLib
  query_params: dict, optional
      Optional query time params for the NMSLib 'setQueryTimeParams' call
  approximate_similar_items : bool, optional
      whether or not to build an NMSLIB index for computing similar_items
  approximate_recommend : bool, optional
      whether or not to build an NMSLIB index for the recommend call
  
  Attributes
  ----------
  similar_items_index : nmslib.FloatIndex
      NMSLib index for looking up similar items in the cosine space formed by the latent
      item_factors
  
  recommend_index : nmslib.FloatIndex
      NMSLib index for looking up similar items in the inner product space formed by the latent
      item_factors
class_docstr_tok: ["Speeds","up","inference","calls","to","MatrixFactorization","models","by","using","`","NMSLib","<","https",":","\/\/github.com\/nmslib\/nmslib",">","`","_","to","create","approximate","nearest","neighbours","indices","of","the","latent","factors",".","Parameters","--","--","--","--","--","model",":","MatrixFactorizationBase","A","matrix","factorization","model","to","use","for","the","factors","method",":","str",",","optional","The","NMSLib","method","to","use","index_params",":","dict",",","optional","Optional","params","to","send","to","the","createIndex","call","in","NMSLib","query_params",":","dict",",","optional","Optional","query","time","params","for","the","NMSLib","'setQueryTimeParams","'","call","approximate_similar_items",":","bool",",","optional","whether","or","not","to","build","an","NMSLIB","index","for","computing","similar_items","approximate_recommend",":","bool",",","optional","whether","or","not","to","build","an","NMSLIB","index","for","the","recommend","call","Attributes","--","--","--","--","--","similar_items_index",":","nmslib.FloatIndex","NMSLib","index","for","looking","up","similar","items","in","the","cosine","space","formed","by","the","latent","item_factors","recommend_index",":","nmslib.FloatIndex","NMSLib","index","for","looking","up","similar","items","in","the","inner","product","space","formed","by","the","latent","item_factors"]
code: def __init__(
      self,
      model,
      approximate_similar_items=True,
      approximate_recommend=True,
      method="hnsw",
      index_params=None,
      query_params=None,
      **kwargs,
  ):
      self.model = model
      if index_params is None:
          index_params = {"M": 16, "post": 0, "efConstruction": 400}
      if query_params is None:
          query_params = {"ef": 90}
  
      self.similar_items_index = None
      self.recommend_index = None
  
      self.approximate_similar_items = approximate_similar_items
      self.approximate_recommend = approximate_recommend
      self.method = method
  
      self.index_params = index_params
      self.query_params = query_params
  
      self.max_norm = None
  
file_path: implicit/implicit/ann/nmslib.py
imports: import logging
  import nmslib
  import numpy
  from scipy.sparse import csr_matrix
  import implicit.gpu
  from implicit.recommender_base import RecommenderBase
  from implicit.utils import _batch_call, _filter_items_from_results, augment_inner_product_matrix
label_desc: Use image node_id 1 to create a new NMSLibModel object from inherited base classes: RecommenderBase with example: obj = NMSLibModel(model, approximate_similar_items, approximate_recommend, method, index_params, query_params)