class_docstr: Approximate Nearest Neighbor Search with Faiss (https://github.com/facebookresearch/faiss).
  Faiss provides both CPU and GPU implementation. More on the algorithms:
  https://github.com/facebookresearch/faiss/wiki
  
  Parameters
  ----------------
  model: object: :obj:`cornac.models.Recommender`, required
      Trained recommender model which to get user/item vectors from.
  
  nlist: int, default: 100
      The number of cells used for building the index.
  
  nprobe: int, default: 50
      The number of cells (out of nlist) that are visited to perform a search.
  
  use_gpu : bool, optional
      Whether or not to run Faiss on GPU. Requires faiss-gpu to be installed
      instead of faiss-cpu.
  
  num_threads: int, optional, default: -1
      Default number of threads used for building index. If num_threads = -1,
      all cores will be used.
  
  seed: int, optional, default: None
      Random seed for reproducibility.
  
  name: str, required
      Name of the recommender model.
  
  verbose: boolean, optional, default: False
      When True, running logs are displayed.
class_docstr_tok: ["Approximate","Nearest","Neighbor","Search","with","Faiss","(","https",":","\/\/github.com\/facebookresearch\/faiss",")",".","Faiss","provides","both","CPU","and","GPU","implementation",".","More","on","the","algorithms",":","https",":","\/\/github.com\/facebookresearch\/faiss\/wiki","Parameters","--","--","--","--","--","--","--","--","model",":","object",":",":","obj",":","`","cornac.models.Recommender","`",",","required","Trained","recommender","model","which","to","get","user\/item","vectors","from",".","nlist",":","int",",","default",":","100","The","number","of","cells","used","for","building","the","index",".","nprobe",":","int",",","default",":","50","The","number","of","cells","(","out","of","nlist",")","that","are","visited","to","perform","a","search",".","use_gpu",":","bool",",","optional","Whether","or","not","to","run","Faiss","on","GPU",".","Requires","faiss-gpu","to","be","installed","instead","of","faiss-cpu",".","num_threads",":","int",",","optional",",","default",":","-1","Default","number","of","threads","used","for","building","index",".","If","num_threads","=","-1",",","all","cores","will","be","used",".","seed",":","int",",","optional",",","default",":","None","Random","seed","for","reproducibility",".","name",":","str",",","required","Name","of","the","recommender","model",".","verbose",":","boolean",",","optional",",","default",":","False","When","True",",","running","logs","are","displayed","."]
code: def __init__(
      self,
      model,
      nlist=100,
      nprobe=50,
      use_gpu=False,
      num_threads=-1,
      seed=None,
      name="FaissANN",
      verbose=False,
  ):
      super().__init__(model=model, name=name, verbose=verbose)
  
      self.nlist = nlist
      self.nprobe = nprobe
      self.use_gpu = use_gpu
      self.num_threads = (
          num_threads
          if num_threads != -1
          else multiprocessing.cpu_count()
      )
      self.seed = seed
  
      self.index = None
      self.ignored_attrs.extend(
          [
              "index",  # will be saved separately
              "item_vectors",  # redundant after index is built
          ]
      )
  
file_path: cornac/cornac/models/ann/recom_ann_faiss.py
imports: import multiprocessing
  import numpy
  from ..recommender import MEASURE_L2, MEASURE_DOT, MEASURE_COSINE
  from .recom_ann_base import BaseANN
label_desc: Use image node_id 1 to create a new FaissANN object from inherited base classes: BaseANN with example: obj = FaissANN(model, nlist, nprobe, use_gpu, num_threads, seed, name, verbose)