docstr: PaCo: EntroPy Anomalies in Co-Clustering
  
  Usage::
  
      >> PaCo(train, 10, 15).compute()
  
  :param train_file: File which contains the train set. This file needs to have at least 3 columns
  (user item feedback_value).
  :type train_file: str
  
  :param k_row: Number of clusters generated by k-means in rows
  :type k_row: int, default None
  
  :param l_col: (int) Number of clusters generated by k-means in rows
  :type l_col: int, default None
  
  :param density_low: Threshold to change the density matrix values
  :type density_low: float, default 0.008
  
  :param as_binary: If True, the explicit feedback will be transform to binary
  :type as_binary: bool, default True
  
  :param sep: Delimiter for input files
  :type sep: str, default '       '
  
  :param random_seed: Number of seed. Lock random numbers for reproducibility of experiments.
  :type random_seed: int, default None
docstr_tok: ["PaCo",":","EntroPy","Anomalies","in","Co-Clustering","Usage",":",":",">",">","PaCo","(","train",",","10",",","15",")",".compute","(",")",":","param","train_file",":","File","which","contains","the","train","set",".","This","file","needs","to","have","at","least","3","columns","(","user","item","feedback_value",")",".",":","type","train_file",":","str",":","param","k_row",":","Number","of","clusters","generated","by","k-means","in","rows",":","type","k_row",":","int",",","default","None",":","param","l_col",":","(","int",")","Number","of","clusters","generated","by","k-means","in","rows",":","type","l_col",":","int",",","default","None",":","param","density_low",":","Threshold","to","change","the","density","matrix","values",":","type","density_low",":","float",",","default","0.008",":","param","as_binary",":","If","True",",","the","explicit","feedback","will","be","transform","to","binary",":","type","as_binary",":","bool",",","default","True",":","param","sep",":","Delimiter","for","input","files",":","type","sep",":","str",",","default","'","'",":","param","random_seed",":","Number","of","seed",".","Lock","random","numbers","for","reproducibility","of","experiments",".",":","type","random_seed",":","int",",","default","None"]
code: def __init__(
      self,
      train_file,
      k_row=None,
      l_col=None,
      density_low=0.008,
      as_binary=True,
      sep="\t",
      random_seed=None,
  ):
      """
      PaCo: EntroPy Anomalies in Co-Clustering
  
      Usage::
  
          >> PaCo(train, 10, 15).compute()
  
      :param train_file: File which contains the train set. This file needs to have at least 3 columns
      (user item feedback_value).
      :type train_file: str
  
      :param k_row: Number of clusters generated by k-means in rows
      :type k_row: int, default None
  
      :param l_col: (int) Number of clusters generated by k-means in rows
      :type l_col: int, default None
  
      :param density_low: Threshold to change the density matrix values
      :type density_low: float, default 0.008
  
      :param as_binary: If True, the explicit feedback will be transform to binary
      :type as_binary: bool, default True
  
      :param sep: Delimiter for input files
      :type sep: str, default '\t'
  
      :param random_seed: Number of seed. Lock random numbers for reproducibility of experiments.
      :type random_seed: int, default None
  
      """
  
      self.train_set = ReadFile(
          train_file, as_binary=as_binary, sep=sep
      ).read()
      self.density_low = density_low
      self.users = self.train_set["users"]
      self.items = self.train_set["items"]
  
      if random_seed is not None:
          np.random.seed(random_seed)
          random.seed(random_seed)
  
      if k_row is None:
          self.k_row = int(np.sqrt(len(self.users)))
      else:
          self.k_row = k_row
  
      if l_col is None:
          self.l_col = int(np.sqrt(len(self.items)))
      else:
          self.l_col = l_col
  
      self.list_row = [list() for _ in range(self.k_row)]
      self.list_col = [list() for _ in range(self.l_col)]
  
      self.item_to_item_id = {}
      self.item_id_to_item = {}
      self.user_to_user_id = {}
      self.user_id_to_user = {}
  
      for i, item in enumerate(self.items):
          self.item_to_item_id.update({item: i})
          self.item_id_to_item.update({i: item})
      for u, user in enumerate(self.users):
          self.user_to_user_id.update({user: u})
          self.user_id_to_user.update({u: user})
  
      self.count_total, self.count_ones = list(), list()
      self.density = None
      self.delta_entropy = list()
      self.matrix = []
  
      self.create_matrix()
  
file_path: CaseRecommender/caserec/clustering/paco.py
imports: import itertools
  import random
  import numpy
  from scipy.spatial.distance import squareform, pdist
  from sklearn.cluster import KMeans
  from caserec.utils.process_data import ReadFile
label_desc: Use image node_id 1 to create a new PaCo object from inherited base classes: object with example: obj = PaCo(train_file, k_row, l_col, density_low, as_binary, sep, random_seed)