code: function updateCenters(data, clusterID, K) {
                  const nDim = data[0].length;
  
                  // creates empty centers with 0 size
                  var centers = new Array(K);
                  var centersLen = new Array(K);
                  for (var i = 0; i < K; i++) {
                      centers[i] = new Array(nDim);
                      centersLen[i] = 0;
                      for (var j = 0; j < nDim; j++) {
                          centers[i][j] = 0;
                      }
                  }
  
                  // add the value for all dimensions of the point
                  for (var l = 0; l < data.length; l++) {
                      centersLen[clusterID[l]]++;
                      for (var dim = 0; dim < nDim; dim++) {
                          centers[clusterID[l]][dim] += data[l][dim];
                      }
                  }
  
                  // divides by length
                  for (var id = 0; id < K; id++) {
                      for (var d = 0; d < nDim; d++) {
                          centers[id][d] /= centersLen[id];
                      }
                  }
                  return centers;
              }
docs: Update the center values based in the new configurations of the clusters
  @ignore
  @param {Array <Array <Number>>} data - the [x,y,z,...] points to cluster
  @param {Array <Number>} clusterID - the cluster identifier for each data dot
  @param {Number} K - Number of clusters
  @returns {Array} he K centers in format [x,y,z,...]