# Path: disentanglement_lib/evaluation/metrics/utils.py
# def generate_batch_factor_code(ground_truth_data, representation_function,
#                                num_points, random_state, batch_size):
# def split_train_test(observations, train_percentage):
# def obtain_representation(observations, representation_function, batch_size):
# def discrete_mutual_info(mus, ys):
# def discrete_entropy(ys):
# def make_discretizer(target, num_bins=gin.REQUIRED,
#                      discretizer_fn=gin.REQUIRED):
# def _histogram_discretize(target, num_bins=gin.REQUIRED):
# def normalize_data(data, mean=None, stddev=None):
# def make_predictor_fn(predictor_fn=gin.REQUIRED):
# def logistic_regression_cv():
# def gradient_boosting_classifier():


from absl import logging
from disentanglement_lib.evaluation.metrics import utils
import numpy as np
import scipy
import gin.tf
      outputs a dim_representation sized representation for each observation.
    random_state: Numpy random state used for randomness.
    artifact_dir: Optional path to directory where artifacts can be saved.
    num_train: Number of points used for training.
    batch_size: Batch size for sampling.

  Returns:
    Dictionary with scores.
  """
  del artifact_dir
  scores = {}
  logging.info("Generating training set.")
  mus_train, _ = utils.generate_batch_factor_code(
      ground_truth_data, representation_function, num_train, random_state,
      batch_size)
  num_codes = mus_train.shape[0]
  cov_mus = np.cov(mus_train)
  assert num_codes == cov_mus.shape[0]

  # Gaussian total correlation.
  scores["gaussian_total_correlation"] = gaussian_total_correlation(cov_mus)

  # Gaussian Wasserstein correlation.
  scores["gaussian_wasserstein_correlation"] = gaussian_wasserstein_correlation(
      cov_mus)
  scores["gaussian_wasserstein_correlation_norm"] = (
      scores["gaussian_wasserstein_correlation"] / np.sum(np.diag(cov_mus)))

  # Compute average mutual information between different factors.
  mus_discrete = utils.make_discretizer(mus_train)

# Path: disentanglement_lib/evaluation/metrics/utils.py
# def generate_batch_factor_code(ground_truth_data, representation_function,
#                                num_points, random_state, batch_size):
# def split_train_test(observations, train_percentage):
# def obtain_representation(observations, representation_function, batch_size):
# def discrete_mutual_info(mus, ys):
# def discrete_entropy(ys):
# def make_discretizer(target, num_bins=gin.REQUIRED,
#                      discretizer_fn=gin.REQUIRED):
# def _histogram_discretize(target, num_bins=gin.REQUIRED):
# def normalize_data(data, mean=None, stddev=None):
# def make_predictor_fn(predictor_fn=gin.REQUIRED):
# def logistic_regression_cv():
# def gradient_boosting_classifier():


# Path: disentanglement_lib/evaluation/metrics/unsupervised_metrics.py
from absl import logging
from disentanglement_lib.evaluation.metrics import utils
import numpy as np
import scipy
import gin.tf

      outputs a dim_representation sized representation for each observation.
    random_state: Numpy random state used for randomness.
    artifact_dir: Optional path to directory where artifacts can be saved.
    num_train: Number of points used for training.
    batch_size: Batch size for sampling.

  Returns:
    Dictionary with scores.
  """
  del artifact_dir
  scores = {}
  logging.info("Generating training set.")
  mus_train, _ = utils.generate_batch_factor_code(
      ground_truth_data, representation_function, num_train, random_state,
      batch_size)
  num_codes = mus_train.shape[0]
  cov_mus = np.cov(mus_train)
  assert num_codes == cov_mus.shape[0]

  # Gaussian total correlation.
  scores["gaussian_total_correlation"] = gaussian_total_correlation(cov_mus)

  # Gaussian Wasserstein correlation.
  scores["gaussian_wasserstein_correlation"] = gaussian_wasserstein_correlation(
      cov_mus)
  scores["gaussian_wasserstein_correlation_norm"] = (
      scores["gaussian_wasserstein_correlation"] / np.sum(np.diag(cov_mus)))

  # Compute average mutual information between different factors.
  mus_discrete = utils.make_discretizer(mus_train)

  mutual_info_matrix = utils.discrete_mutual_info(mus_discrete, mus_discrete)