class_docstr: Spherical k-means based recommender.
  
  Parameters
  ----------
  k: int, optional, default: 5
      The number of clusters.
  
  max_iter: int, optional, default: 100
      Maximum number of iterations.
  
  name: string, optional, default: 'Skmeans'
      The name of the recommender model.
  
  trainable: boolean, optional, default: True
      When False, the model is not trained and Cornac assumes that the model is already         trained. 
      
  tol : float, optional, default: 1e-6
      Relative tolerance with regards to skmeans' criterion to declare convergence.
      
  verbose: boolean, optional, default: False
      When True, some running logs are displayed.
  
  seed: int, optional, default: None
      Random seed for parameters initialization.
  
  init_par: numpy 1d array, optional, default: None
      The initial object parition, 1d array contaning the cluster label (int type starting from 0)         of each object (user). If par = None, then skmeans is initialized randomly.
    
  centroids: csc_matrix, shape (k,n_users)
      The maxtrix of cluster centroids.
  
  References
  ----------
  * Salah, Aghiles, Nicoleta Rogovschi, and Mohamed Nadif. "A dynamic collaborative filtering system     via a weighted clustering approach." Neurocomputing 175 (2016): 206-215.
docstr: Predict the scores/ratings of a user for an item.
  
  Parameters
  ----------
  user_idx: int, required
      The index of the user for whom to perform score prediction.
  
  item_idx: int, optional, default: None
      The index of the item for which to perform score prediction.
      If None, scores for all known items will be returned.
  
  Returns
  -------
  res : A scalar or a Numpy array
      Relative scores that the user gives to the item or to all known items
docstr_tok: ["Predict","the","scores\/ratings","of","a","user","for","an","item",".","Parameters","--","--","--","--","--","user_idx",":","int",",","required","The","index","of","the","user","for","whom","to","perform","score","prediction",".","item_idx",":","int",",","optional",",","default",":","None","The","index","of","the","item","for","which","to","perform","score","prediction",".","If","None",",","scores","for","all","known","items","will","be","returned",".","Returns","--","--","--","-","res",":","A","scalar","or","a","Numpy","array","Relative","scores","that","the","user","gives","to","the","item","or","to","all","known","items"]
code: def score(self, user_idx, item_idx=None):
      """Predict the scores/ratings of a user for an item.
  
      Parameters
      ----------
      user_idx: int, required
          The index of the user for whom to perform score prediction.
  
      item_idx: int, optional, default: None
          The index of the item for which to perform score prediction.
          If None, scores for all known items will be returned.
  
      Returns
      -------
      res : A scalar or a Numpy array
          Relative scores that the user gives to the item or to all known items
  
      """
      if self.is_unknown_user(user_idx):
          raise ScoreException(
              "Can't make score prediction for user %d" % user_idx
          )
  
      if item_idx is not None and self.is_unknown_item(item_idx):
          raise ScoreException(
              "Can't make score prediction for item %d" % item_idx
          )
  
      if item_idx is None:
          known_item_scores = self.centroids.multiply(
              self.user_center_sim[user_idx, :].T
          )
          known_item_scores = known_item_scores.sum(0).A1 / (
              self.user_center_sim[user_idx, :].sum() + 1e-20
          )  # weighted average of cluster centroids
          return known_item_scores
      else:
          user_pred = self.centroids[item_idx, :].multiply(
              self.user_center_sim[user_idx, :].T
          )
          # transform user_pred to a flatten array
          user_pred = user_pred.sum(0).A1 / (
              self.user_center_sim[user_idx, :].sum() + 1e-20
          )  # weighted average of cluster centroids
          return user_pred
  
file_path: cornac/cornac/models/skm/recom_skmeans.py
imports: import numpy
  import scipy.sparse
  from ..recommender import Recommender
  from ...exception import ScoreException
label_desc: Use image node_id 3 for calling the SKMeans obj's underlying member method code with example usage: obj.score(user_idx, item_idx) and returns: known_item_scores, user_pred