class_docstr: A simple clustering method that forms k clusters by first assigning
  samples to the closest medoids, and then swapping medoids with non-medoid
  samples if the total distance (cost) between the cluster members and their medoid
  is smaller than prevoisly.
  
  
  Parameters:
  -----------
  k: int
      The number of clusters the algorithm will form.
class_docstr_tok: ["A","simple","clustering","method","that","forms","k","clusters","by","first","assigning","samples","to","the","closest","medoids",",","and","then","swapping","medoids","with","non-medoid","samples","if","the","total","distance","(","cost",")","between","the","cluster","members","and","their","medoid","is","smaller","than","prevoisly",".","Parameters",":","--","--","--","--","--","-","k",":","int","The","number","of","clusters","the","algorithm","will","form","."]
docstr: Calculate the cost (total distance between samples and their medoids) 
docstr_tok: ["Calculate","the","cost","(","total","distance","between","samples","and","their","medoids",")"]
code: def _calculate_cost(self, X, clusters, medoids):
      """Calculate the cost (total distance between samples and their medoids)"""
      cost = 0
      # For each cluster
      for i, cluster in enumerate(clusters):
          medoid = medoids[i]
          for sample_i in cluster:
              # Add distance between sample and medoid as cost
              cost += euclidean_distance(X[sample_i], medoid)
      return cost
  
file_path: ML-From-Scratch/mlfromscratch/unsupervised_learning/partitioning_around_medoids.py
imports: from __future__ import print_function, division
  import numpy
  from mlfromscratch.utils import normalize, euclidean_distance, Plot
  from mlfromscratch.unsupervised_learning import PCA
label_desc: Use image node_id 5 for calling the PAM obj's underlying member method code with example usage: obj._calculate_cost(X, clusters, medoids) and returns: cost