class_docstr: User-Based Nearest Neighbor.
  
  Parameters
  ----------
  name: string, default: 'UserKNN'
      The name of the recommender model.
  
  k: int, optional, default: 20
      The number of nearest neighbors.
  
  similarity: str, optional, default: 'cosine'
      The similarity measurement. Supported types: ['cosine', 'pearson']
  
  mean_centered: bool, optional, default: False
      Whether values of the user-item rating matrix will be centered by the mean
      of their corresponding rows (mean rating of each user).
  
  weighting: str, optional, default: None
      The option for re-weighting the rating matrix. Supported types: ['idf', 'bm25'].
      If None, no weighting is applied.
  
  amplify: float, optional, default: 1.0
      Amplifying the influence on similarity weights.
  
  num_threads: int, optional, default: 0
      Number of parallel threads for training. If num_threads=0, all CPU cores will be utilized.
      If seed is not None, num_threads=1 to remove randomness from parallelization.
  
  seed: int, optional, default: None
      Random seed for weight initialization.
  
  References
  ----------
  * CarlKadie, J. B. D. (1998). Empirical analysis of predictive algorithms for collaborative filtering. Microsoft Research Microsoft Corporation One Microsoft Way Redmond, WA, 98052.
  * Aggarwal, C. C. (2016). Recommender systems (Vol. 1). Cham: Springer International Publishing.
code: def __init__(
      self,
      name="UserKNN",
      k=20,
      similarity="cosine",
      mean_centered=False,
      weighting=None,
      amplify=1.0,
      num_threads=0,
      trainable=True,
      verbose=True,
      seed=None,
  ):
      super().__init__(name=name, trainable=trainable, verbose=verbose)
      self.k = k
      self.similarity = similarity
      self.mean_centered = mean_centered
      self.weighting = weighting
      self.amplify = amplify
      self.seed = seed
      self.rng = get_rng(seed)
  
      if self.similarity not in SIMILARITIES:
          raise ValueError(
              "Invalid similarity choice, supported {}".format(
                  SIMILARITIES
              )
          )
  
      if (
          self.weighting is not None
          and self.weighting not in WEIGHTING_OPTIONS
      ):
          raise ValueError(
              "Invalid weighting choice, supported {}".format(
                  WEIGHTING_OPTIONS
              )
          )
  
      if seed is not None:
          self.num_threads = 1
      elif (
          num_threads > 0 and num_threads < multiprocessing.cpu_count()
      ):
          self.num_threads = num_threads
      else:
          self.num_threads = multiprocessing.cpu_count()
  
imports: import multiprocessing
  import numpy
  from scipy.sparse import csr_matrix, coo_matrix
  from ..recommender import Recommender
  from ...exception import ScoreException
  from ...utils import get_rng
  from ...utils.fast_sparse_funcs import inplace_csr_row_normalize_l2
  from .similarity import compute_similarity, compute_score, compute_score_single
label_desc: Use image node_id 1 to create a new UserKNN object from inherited base classes: Recommender with example: obj = UserKNN(name, k, similarity, mean_centered, weighting, amplify, num_threads, trainable, verbose, seed)