class_docstr: EASE is a linear model for collaborative filtering, which combines the
  strengths of auto-encoders and neighborhood-based approaches.
code: def __init__(self, config, dataset):
      super().__init__(config, dataset)
  
      # load parameters info
      reg_weight = config["reg_weight"]
  
      # need at least one param
      self.dummy_param = torch.nn.Parameter(torch.zeros(1))
  
      X = dataset.inter_matrix(form="csr").astype(np.float32)
      # just directly calculate the entire score matrix in init
      # (can't be done incrementally)
  
      # gram matrix
      G = X.T @ X
  
      # add reg to diagonal
      G += reg_weight * sp.identity(G.shape[0]).astype(np.float32)
  
      # convert to dense because inverse will be dense
      G = G.todense()
  
      # invert. this takes most of the time
      P = np.linalg.inv(G)
      B = P / (-np.diag(P))
      # zero out diag
      np.fill_diagonal(B, 0.0)
  
      # instead of computing and storing the entire score matrix,
      # just store B and compute the scores on demand
      # more memory efficient for a larger number of users
      # but if there's a large number of items not much one can do:
      # still have to compute B all at once
      # S = X @ B
      # self.score_matrix = torch.from_numpy(S).to(self.device)
  
      # torch doesn't support sparse tensor slicing,
      # so will do everything with np/scipy
      self.item_similarity = B
      self.interaction_matrix = X
      self.other_parameter_name = [
          "interaction_matrix",
          "item_similarity",
      ]
      self.device = config.device
  
file_path: RecBole/recbole/model/general_recommender/ease.py
imports: import torch
  import numpy
  import scipy.sparse
  from recbole.utils import InputType, ModelType
  from recbole.model.abstract_recommender import GeneralRecommender
label_desc: Use image node_id 1 to create a new EASE object from inherited base classes: GeneralRecommender with example: obj = EASE(config, dataset)