code: def decode_centroids(encoded, mapping):
      
      decoded = []
      for ii in range(encoded.shape[1]):
          # Invert the mapping so that we can decode.
          inv_mapping = {v: k for k, v in mapping[ii].items()}
          decoded.append(np.vectorize(inv_mapping.__getitem__)(encoded[:, ii]))
      return np.atleast_2d(np.array(decoded)).T
docs: Decodes the encoded centroids array back to the original data
      labels using a list of mappings.