class_docstr: This is an abstract class aimed to ease the use of symmetric algorithms.
  
  A symmetric algorithm is an algorithm that can be based on users or on
  items indifferently, e.g. all the algorithms in this module.
  
  When the algo is user-based x denotes a user and y an item. Else, it's
  reversed.
class_docstr_tok: ["This","is","an","abstract","class","aimed","to","ease","the","use","of","symmetric","algorithms",".","A","symmetric","algorithm","is","an","algorithm","that","can","be","based","on","users","or","on","items","indifferently",",","e.g",".","all","the","algorithms","in","this","module",".","When","the","algo","is","user-based","x","denotes","a","user","and","y","an","item",".","Else",",","it's","reversed","."]
code: def fit(self, trainset):
      AlgoBase.fit(self, trainset)
  
      ub = self.sim_options["user_based"]
      self.n_x = self.trainset.n_users if ub else self.trainset.n_items
      self.n_y = self.trainset.n_items if ub else self.trainset.n_users
      self.xr = self.trainset.ur if ub else self.trainset.ir
      self.yr = self.trainset.ir if ub else self.trainset.ur
  
      return self
  
imports: import heapq
  import numpy
  from .algo_base import AlgoBase
  from .predictions import PredictionImpossible
label_desc: Use image node_id 2 for calling the SymmetricAlgo obj's underlying member method code with example usage: obj.fit(trainset) and returns: self