libmultilabel/utils.py
def dump_log(log_path, metrics=None, split=None, config=None):
    """Write log including config and the evaluation scores.

    Args:
        log_path(str): path to log path
        metrics (dict): metric and scores in dictionary format, defaults to None
        split (str): val or test, defaults to None
        config (dict): config to save, defaults to None
    """
    os.makedirs(os.path.dirname(log_path), exist_ok=True)
    if os.path.isfile(log_path):
        with open(log_path) as fp:
            result = json.load(fp)
    else:
        result = dict()

    if config:
        config_to_save = copy.deepcopy(dict(config))
        config_to_save.pop('device', None)  # delete if device exists
        result['config'] = config_to_save
    if split and metrics:
        if split in result:
            result[split].append(metrics)
        else:
            result[split] = [metrics]

    with open(log_path, 'w') as fp:
        json.dump(result, fp)

    logging.info(f'Finish writing log to {log_path}.')
Write log including config and the evaluation scores.

    Args:
        log_path(str): path to log path
        metrics (dict): metric and scores in dictionary format, defaults to None
        split (str): val or test, defaults to None
        config (dict): config to save, defaults to None
    
Write log including config and the evaluation scores.
Write log including config and the evaluation scores .
def dump_log(log_path, metrics=None, split=None, config=None):
    os.makedirs(os.path.dirname(log_path), exist_ok=True)
    if os.path.isfile(log_path):
        with open(log_path) as fp:
            result = json.load(fp)
    else:
        result = dict()
    if config:
        config_to_save = copy.deepcopy(dict(config))
        config_to_save.pop('device', None)  
        result['config'] = config_to_save
    if split and metrics:
        if split in result:
            result[split].append(metrics)
        else:
            result[split] = [metrics]
    with open(log_path, 'w') as fp:
        json.dump(result, fp)
    logging.info(f'Finish writing log to {log_path}.')
def dump_log ( log_path , metrics = None , split = None , config = None ) : os . makedirs ( os . path . dirname ( log_path ) , exist_ok = True ) if os . path . isfile ( log_path ) : with open ( log_path ) as fp : result = json . load ( fp ) else : result = dict ( ) if config : config_to_save = copy . deepcopy ( dict ( config ) ) config_to_save . pop ( 'device' , None ) result [ 'config' ] = config_to_save if split and metrics : if split in result : result [ split ] . append ( metrics ) else : result [ split ] = [ metrics ] with open ( log_path , 'w' ) as fp : json . dump ( result , fp ) logging . info ( f'Finish writing log to {log_path}.' )
Write log including config and the evaluation scores.
Write log including config and the evaluation scores .
"""Write log including config and the evaluation scores.

    Args:
        log_path(str): path to log path
        metrics (dict): metric and scores in dictionary format, defaults to None
        split (str): val or test, defaults to None
        config (dict): config to save, defaults to None
    """ # delete if device exists
log_path
path to log path
path to log path
metrics
metric and scores in dictionary format, defaults to None
metric and scores in dictionary format defaults to None
split
val or test, defaults to None
val or test defaults to None
config
config to save, defaults to None
config to save defaults to None