docstr: Method to compute a distance matrix from train set
docstr_tok: ["Method","to","compute","a","distance","matrix","from","train","set"]
code: def compute_distance(self):
      """
      Method to compute a distance matrix from train set
  
      """
  
      # Calculate distance matrix
      distance_matrix = np.float32(
          squareform(pdist(self.matrix, self.similarity_metric))
      )
      # Remove NaNs
      distance_matrix[np.isnan(distance_matrix)] = 1.0
  
      return distance_matrix
  
imports: from scipy.spatial.distance import squareform, pdist
  import numpy
  import os
  from caserec.clustering.kmedoids import kmedoids
  from caserec.recommenders.item_recommendation.base_item_recommendation import BaseItemRecommendation
  from caserec.recommenders.item_recommendation.itemknn import ItemKNN
  from caserec.recommenders.item_recommendation.most_popular import MostPopular
  from caserec.recommenders.item_recommendation.userknn import UserKNN
  from caserec.utils.process_data import ReadFile, WriteFile
  from caserec.recommenders.item_recommendation.bprmf import BprMF
label_desc: Use image node_id 3 for calling the GroupBasedRecommender obj's underlying member method code with example usage: obj.compute_distance() and returns: distance_matrix