def epoch_rates_to_pmf(problems, epoch_rates=None):
  """Create a probability-mass-function based on relative epoch rates.

  if epoch_rates=None, then we use uniform epoch rates [1.0] * len(problems)
  i.e. it takes each problem the same time to go through one epoch.

  If epoch_rates is given, then these are the relative numbers of epochs
  of each problem to go through in a given amount of time.

  Each must have problem.num_training_examples implemented.

  Args:
    problems: a list of Problem instances.
    epoch_rates: an optional list of float

  Returns:
    a list of floating point values.
  """
  if epoch_rates is None:
    epoch_rates = [1.0] * len(problems)
  example_rates = [epoch_rate * p.num_training_examples
                   for p, epoch_rate in zip(problems, epoch_rates)]
  return example_rates_to_pmf(example_rates)
Create a probability-mass-function based on relative epoch rates.

  if epoch_rates=None, then we use uniform epoch rates [1.0] * len(problems)
  i.e. it takes each problem the same time to go through one epoch.

  If epoch_rates is given, then these are the relative numbers of epochs
  of each problem to go through in a given amount of time.

  Each must have problem.num_training_examples implemented.

  Args:
    problems: a list of Problem instances.
    epoch_rates: an optional list of float

  Returns:
    a list of floating point values.