# 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 disentanglement_lib.evaluation.metrics import utils
from six.moves import range
import numpy as np
import gin.tf
  values for that factor. We repeat the experiment n_experiment times, to ensure
  robustness.

  Args:
    ground_truth_data: GroundTruthData to be sampled from.
    representation_function: Function that takes observations as input and
      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.
    num_test: Number of points used for testing.
    n_experiment: Number of repetitions of the experiment.

  Returns:
    Dictionary with scores.
  """
  del artifact_dir
  scores = {}
  for train_size in num_train:
    # sample factors
    factors_train = ground_truth_data.sample_factors(train_size, random_state)
    factors_test = ground_truth_data.sample_factors(num_test, random_state)
    # obtain_observations without intervention
    x_train = ground_truth_data.sample_observations_from_factors(
        factors_train, random_state)
    x_test = ground_truth_data.sample_observations_from_factors(
        factors_test, random_state)
    mus_train = representation_function(x_train)
    mus_test = representation_function(x_test)
    # train predictor on data without interbention

# 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/strong_downstream_task.py
from disentanglement_lib.evaluation.metrics import utils
from six.moves import range
import numpy as np
import gin.tf

  values for that factor. We repeat the experiment n_experiment times, to ensure
  robustness.

  Args:
    ground_truth_data: GroundTruthData to be sampled from.
    representation_function: Function that takes observations as input and
      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.
    num_test: Number of points used for testing.
    n_experiment: Number of repetitions of the experiment.

  Returns:
    Dictionary with scores.
  """
  del artifact_dir
  scores = {}
  for train_size in num_train:
    # sample factors
    factors_train = ground_truth_data.sample_factors(train_size, random_state)
    factors_test = ground_truth_data.sample_factors(num_test, random_state)
    # obtain_observations without intervention
    x_train = ground_truth_data.sample_observations_from_factors(
        factors_train, random_state)
    x_test = ground_truth_data.sample_observations_from_factors(
        factors_test, random_state)
    mus_train = representation_function(x_train)
    mus_test = representation_function(x_test)
    # train predictor on data without interbention

    predictor_model = utils.make_predictor_fn()