def log_similarity_result(logfile, result):
    """Log a similarity evaluation result dictionary as TSV to logfile."""
    assert result['task'] == 'similarity'

    if not logfile:
        return

    with open(logfile, 'a') as f:
        f.write('\t'.join([
            str(result['global_step']),
            result['task'],
            result['dataset_name'],
            json.dumps(result['dataset_kwargs']),
            result['similarity_function'],
            str(result['spearmanr']),
            str(result['num_dropped']),
        ]))

        f.write('\n')
def log_similarity_result ( logfile , result ) : assert result [ 'task' ] == 'similarity' if not logfile : return with open ( logfile , 'a' ) as f : f . write ( '\t' . join ( [ str ( result [ 'global_step' ] ) , result [ 'task' ] , result [ 'dataset_name' ] , json . dumps ( result [ 'dataset_kwargs' ] ) , result [ 'similarity_function' ] , str ( result [ 'spearmanr' ] ) , str ( result [ 'num_dropped' ] ) , ] ) ) f . write ( '\n' )
Log a similarity evaluation result dictionary as TSV to logfile.