code: private double bic(int k, int n, int d, double distortion, int[] clusterSize) {
          double variance = distortion / (n - k);
  
          double L = 0.0;
          for (int i = 0; i < k; i++) {
              L += logLikelihood(k, n, clusterSize[i], d, variance);
          }
  
          int numParameters = k + k * d;
          return L - 0.5 * numParameters * Math.log(n);
      }
docs: Calculates the BIC for the given set of centers.
  @param k the number of clusters.
  @param n the total number of samples.
  @param d the dimensionality of data.
  @param distortion the distortion of clusters.
  @param clusterSize the number of samples in each cluster.
  @return the BIC score.