class_docstr: Approximate Nearest Neighbor Search with ScaNN
  (https://github.com/google-research/google-research/tree/master/scann).
  ScaNN performs vector search in three phases: paritioning, scoring, and rescoring.
  More on the algorithms and parameter description: https://github.com/google-research/google-research/blob/master/scann/docs/algorithms.md
  
  Parameters
  ----------------
  model: object: :obj:`cornac.models.Recommender`, required
      Trained recommender model which to get user/item vectors from.
  
  partition_params: dict, optional
      Parameters for the partitioning phase, to send to the tree() call in ScaNN.
  
  score_params: dict, optional
      Parameters for the scoring phase, to send to the score_ah() call in ScaNN.
      score_brute_force() will be called if score_brute_force is True.
  
  score_brute_force: bool, optional, default: False
      Whether to call score_brute_force() for the scoring phase.
  
  rescore_params: dict, optional
      Parameters for the rescoring phase, to send to the reorder() call in ScaNN.
  
  num_threads: int, optional, default: -1
      Default number of threads used for training. 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.
docstr: Building index from the base recommender model.
code: def build_index(self):
      """Building index from the base recommender model."""
      super().build_index()
  
      import scann
  
      assert self.measure in SUPPORTED_MEASURES
  
      if self.measure == MEASURE_COSINE:
          self.partition_params["spherical"] = True
          self.item_vectors /= np.linalg.norm(
              self.item_vectors, axis=1
          )[:, np.newaxis]
      else:
          self.partition_params["spherical"] = False
  
      index_builder = scann.scann_ops_pybind.builder(
          self.item_vectors, 10, SUPPORTED_MEASURES[self.measure]
      )
      index_builder.set_n_training_threads(self.num_threads)
  
      # partitioning
      if self.partition_params:
          self.partition_params.setdefault(
              "training_sample_size", self.item_vectors.shape[0]
          )
          index_builder = index_builder.tree(**self.partition_params)
  
      # scoring
      if self.score_brute_force:
          index_builder = index_builder.score_brute_force(
              **self.score_params
          )
      else:
          index_builder = index_builder.score_ah(**self.score_params)
  
      # rescoring
      if self.rescore_params:
          index_builder = index_builder.reorder(**self.rescore_params)
  
      self.index = index_builder.build()
  
file_path: cornac/cornac/models/ann/recom_ann_scann.py
imports: import os
  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 2 for calling the ScaNNANN obj's underlying member method code with example usage: obj.build_index() without return types