(self)
return ret_dict
Returns a dictionary for serialization to JSON.

    Each member is converted to an elementary type that can be serialized to
    JSON readily.
Returns a dictionary for serialization to JSON.
Returns a dictionary for serialization to JSON .
def to_dict(self):
    """Returns a dictionary for serialization to JSON.

    Each member is converted to an elementary type that can be serialized to
    JSON readily.
    """
    # Start with the dict representation of the namedtuple
    ret_dict = self._asdict()
    # Add the class name for reconstruction when deserialized
    ret_dict['__class__'] = self.__class__.__name__
    # Convert Split enum instances to their name (string)
    ret_dict['classes_per_split'] = {
        split.name: count
        for split, count in six.iteritems(ret_dict['classes_per_split'])
    }
    # Convert binary class names to unicode strings if necessary
    class_names = {}
    for class_id, name in six.iteritems(ret_dict['class_names']):
      if isinstance(name, six.binary_type):
        name = name.decode()
      elif isinstance(name, np.integer):
        name = six.text_type(name)
      class_names[class_id] = name
    ret_dict['class_names'] = class_names
    return ret_dict
def to_dict ( self ) : # Start with the dict representation of the namedtuple ret_dict = self . _asdict ( ) # Add the class name for reconstruction when deserialized ret_dict [ '__class__' ] = self . __class__ . __name__ # Convert Split enum instances to their name (string) ret_dict [ 'classes_per_split' ] = { split . name : count for split , count in six . iteritems ( ret_dict [ 'classes_per_split' ] ) } # Convert binary class names to unicode strings if necessary class_names = { } for class_id , name in six . iteritems ( ret_dict [ 'class_names' ] ) : if isinstance ( name , six . binary_type ) : name = name . decode ( ) elif isinstance ( name , np . integer ) : name = six . text_type ( name ) class_names [ class_id ] = name ret_dict [ 'class_names' ] = class_names return ret_dict