def to_json(self, indent=None, separators=None, sort_keys=False):
    """Serializes the hyperparameters into JSON.

    Args:
      indent: If a non-negative integer, JSON array elements and object members
        will be pretty-printed with that indent level. An indent level of 0, or
        negative, will only insert newlines. `None` (the default) selects the
        most compact representation.
      separators: Optional `(item_separator, key_separator)` tuple. Default is
        `(', ', ': ')`.
      sort_keys: If `True`, the output dictionaries will be sorted by key.

    Returns:
      A JSON string.
    """
    def remove_callables(x):
      """Omit callable elements from input with arbitrary nesting."""
      if isinstance(x, dict):
        return {k: remove_callables(v) for k, v in six.iteritems(x)
                if not callable(v)}
      elif isinstance(x, list):
        return [remove_callables(i) for i in x if not callable(i)]
      return x
    return json.dumps(
        remove_callables(self.values()),
        indent=indent,
        separators=separators,
        sort_keys=sort_keys)