class_docstr: Approximate Nearest Neighbor Search with HNSWLib (https://github.com/nmslib/hnswlib/).
  
  Parameters
  ----------------
  model: object: :obj:`cornac.models.Recommender`, required
      Trained recommender model which to get user/item vectors from.
  
  M: int, optional, default: 16
      Parameter that defines the maximum number of outgoing connections in the HNSW graph.
      Higher M leads to higher accuracy/run_time at fixed ef/ef_construction. Reasonable range
      for M is 2-100. Higher M work better on model with high dimensional factors, while low M
      work better for low dimensional factors. More details: https://github.com/nmslib/hnswlib/blob/master/ALGO_PARAMS.md.
  
  ef_construction: int, optional, default: 100
      Parameter that controls speed/accuracy trade-off during the index construction. Bigger ef_construction leads to longer construction, but better index quality. At some point,
      increasing ef_construction does not improve the quality of the index.
  
  ef: int, optional, default: 50
      Parameter controlling query time/accuracy trade-off. Higher `ef` leads to more accurate but
      slower search. `ef` cannot be set lower than the number of queried nearest neighbors k. The
      value of `ef` can be anything between `k` and the total number of items.
  
  num_threads: int, optional, default: -1
      Default number of threads to use when querying. 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","HNSWLib","(","https",":","\/\/github.com\/nmslib\/hnswlib\/",")",".","Parameters","--","--","--","--","--","--","--","--","model",":","object",":",":","obj",":","`","cornac.models.Recommender","`",",","required","Trained","recommender","model","which","to","get","user\/item","vectors","from",".","M",":","int",",","optional",",","default",":","16","Parameter","that","defines","the","maximum","number","of","outgoing","connections","in","the","HNSW","graph",".","Higher","M","leads","to","higher","accuracy\/run_time","at","fixed","ef\/ef_construction",".","Reasonable","range","for","M","is","2-100",".","Higher","M","work","better","on","model","with","high","dimensional","factors",",","while","low","M","work","better","for","low","dimensional","factors",".","More","details",":","https",":","\/\/github.com\/nmslib\/hnswlib\/blob\/master\/ALGO_PARAMS.md",".","ef_construction",":","int",",","optional",",","default",":","100","Parameter","that","controls","speed\/accuracy","trade-off","during","the","index","construction",".","Bigger","ef_construction","leads","to","longer","construction",",","but","better","index","quality",".","At","some","point",",","increasing","ef_construction","does","not","improve","the","quality","of","the","index",".","ef",":","int",",","optional",",","default",":","50","Parameter","controlling","query","time\/accuracy","trade-off",".","Higher","`","ef","`","leads","to","more","accurate","but","slower","search",".","`","ef","`","can","not","be","set","lower","than","the","number","of","queried","nearest","neighbors","k.","The","value","of","`","ef","`","can","be","anything","between","`","k","`","and","the","total","number","of","items",".","num_threads",":","int",",","optional",",","default",":","-1","Default","number","of","threads","to","use","when","querying",".","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 save(self, save_dir=None):
      saved_path = super().save(save_dir)
      self.index.save_index(saved_path + ".index")
      return saved_path
  
file_path: cornac/cornac/models/ann/recom_ann_hnswlib.py
imports: import sys
  import random
  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 4 for calling the HNSWLibANN obj's underlying member method code with example usage: obj.save(save_dir) and returns: saved_path