class_docstr: Approximate Nearest Neighbor Search with Annoy (https://github.com/spotify/annoy).
  
  Parameters
  ----------------
  model: object: :obj:`cornac.models.Recommender`, required
      Trained recommender model which to get user/item vectors from.
  
  n_trees: int, default: 100
      The number of trees used to build index. It affects the build time and the
      index size. A larger value will give more accurate results, but larger indexes.
  
  search_k: int, default: 50
      Parameter controls the search performance and runtime. A larger value will
      give more accurate results, but will take longer time to return.
  
  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.
docstr: Implementing ANN search for a given query.
  
  Returns
  -------
  neighbors, distances: numpy.array and numpy.array
      Array of k-nearest neighbors and corresponding distances for the given query.
code: def knn_query(self, query, k):
      """Implementing ANN search for a given query.
  
      Returns
      -------
      neighbors, distances: numpy.array and numpy.array
          Array of k-nearest neighbors and corresponding distances for the given query.
      """
      result = [
          self.index.get_nns_by_vector(
              q, k, search_k=self.search_k, include_distances=True
          )
          for q in query
      ]
      neighbors = np.array([r[0] for r in result], dtype="int")
      distances = np.array([r[1] for r in result], dtype="float32")
  
      # make sure distances respect the notion of nearest neighbors (smaller is better)
      if self.higher_is_better:
          distances = 1.0 - distances
  
      return neighbors, distances
  
file_path: cornac/cornac/models/ann/recom_ann_annoy.py
imports: import numpy
  from ..recommender import MEASURE_L2, MEASURE_DOT, MEASURE_COSINE
  from .recom_ann_base import BaseANN
label_desc: Use image node_id 3 for calling the AnnoyANN obj's underlying member method code with example usage: obj.knn_query(query, k) and returns: neighbors,  distances