# 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
from six.moves import range
from sklearn import ensemble
import numpy as np
import scipy
import gin.tf
  scores["completeness"] = completeness(importance_matrix)
  return scores


@gin.configurable(
    "dci_validation",
    blacklist=["observations", "labels", "representation_function"])
def compute_dci_on_fixed_data(observations, labels, representation_function,
                              train_percentage=gin.REQUIRED, batch_size=100):
  """Computes the DCI scores on the fixed set of observations and labels.

  Args:
    observations: Observations on which to compute the score. Observations have
      shape (num_observations, 64, 64, num_channels).
    labels: Observed factors of variations.
    representation_function: Function that takes observations as input and
      outputs a dim_representation sized representation for each observation.
    train_percentage: Percentage of observations used for training.
    batch_size: Batch size used to compute the representation.

  Returns:
    DCI score.
  """
  mus = utils.obtain_representation(observations, representation_function,
                                    batch_size)
  assert labels.shape[1] == observations.shape[0], "Wrong labels shape."
  assert mus.shape[1] == observations.shape[0], "Wrong representation shape."
  mus_train, mus_test = utils.split_train_test(
      mus,
      train_percentage)

# 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/dci.py
from absl import logging
from disentanglement_lib.evaluation.metrics import utils
from six.moves import range
from sklearn import ensemble
import numpy as np
import scipy
import gin.tf

  scores["completeness"] = completeness(importance_matrix)
  return scores


@gin.configurable(
    "dci_validation",
    blacklist=["observations", "labels", "representation_function"])
def compute_dci_on_fixed_data(observations, labels, representation_function,
                              train_percentage=gin.REQUIRED, batch_size=100):
  """Computes the DCI scores on the fixed set of observations and labels.

  Args:
    observations: Observations on which to compute the score. Observations have
      shape (num_observations, 64, 64, num_channels).
    labels: Observed factors of variations.
    representation_function: Function that takes observations as input and
      outputs a dim_representation sized representation for each observation.
    train_percentage: Percentage of observations used for training.
    batch_size: Batch size used to compute the representation.

  Returns:
    DCI score.
  """
  mus = utils.obtain_representation(observations, representation_function,
                                    batch_size)
  assert labels.shape[1] == observations.shape[0], "Wrong labels shape."
  assert mus.shape[1] == observations.shape[0], "Wrong representation shape."
  mus_train, mus_test = utils.split_train_test(
      mus,
      train_percentage)

  ys_train, ys_test = utils.split_train_test(