docs: def inertia(X,y,samples=False):
      """ return the within-class squared distance from the centroid"""
      # pdb.set_trace()
      if samples:
          # return within-class distance for each sample
          inertia = np.zeros(y.shape)
          for label in np.unique(y):
              inertia[y==label] = (X[y==label] - np.mean(X[y==label])) ** 2
  
      else: # return aggregate score
          inertia = 0
          for i,label in enumerate(np.unique(y)):
              inertia += np.sum((X[y==label] - np.mean(X[y==label])) ** 2)/len(y[y==label])
          inertia = inertia/len(np.unique(y))
  
      return inertia