code: def algebra_simplify(alphabet_size=26,
                       min_depth=0,
                       max_depth=2,
                       nbr_cases=10000):
    
    if max_depth < min_depth:
      raise ValueError("max_depth must be greater than or equal to min_depth. "
                       "Got max_depth=%s, min_depth=%s" % (max_depth, min_depth))
  
    alg_cfg = math_dataset_init(alphabet_size, digits=5)
    for _ in range(nbr_cases):
      sample, target = generate_algebra_simplify_sample(
          alg_cfg.vlist, list(alg_cfg.ops.values()), min_depth, max_depth)
      yield {
          "inputs": alg_cfg.int_encoder(sample),
          "targets": alg_cfg.int_encoder(target)
      }
docs: Generate the algebra simplify dataset.
  
    Each sample is a symbolic math expression involving unknown variables. The
    task is to simplify the expression. The target is the resulting expression.
  
    Args:
      alphabet_size: How many possible variables there are. Max 52.
      min_depth: Minimum depth of the expression trees on both sides of the
          equals sign in the equation.
      max_depth: Maximum depth of the expression trees on both sides of the
          equals sign in the equation.
      nbr_cases: The number of cases to generate.
  
    Yields:
      A dictionary {"inputs": input-list, "targets": target-list} where
      input-list are the tokens encoding the expression to simplify, and
      target-list is a list of tokens encoding the resulting math expression after
      simplifying.
  
    Raises:
      ValueError: If `max_depth` < `min_depth`.