(metrics, weights, prefix='')
Prints weighted averages of the given metrics.

    Args:
        metrics: dict with client ids as keys. Each entry is a dict
            with the metrics of that client.
        weights: dict with client ids as keys. Each entry is the weight
            for that client.
Prints weighted averages of the given metrics.
Prints weighted averages of the given metrics .
def print_metrics(metrics, weights, prefix=''):
    """Prints weighted averages of the given metrics.

    Args:
        metrics: dict with client ids as keys. Each entry is a dict
            with the metrics of that client.
        weights: dict with client ids as keys. Each entry is the weight
            for that client.
    """
    ordered_weights = [weights[c] for c in sorted(weights)]
    metric_names = metrics_writer.get_metrics_names(metrics)
    to_ret = None
    for metric in metric_names:
        ordered_metric = [metrics[c][metric] for c in sorted(metrics)]
        print('%s: %g, 10th percentile: %g, 50th percentile: %g, 90th percentile %g' \
              % (prefix + metric,
                 np.average(ordered_metric, weights=ordered_weights),
                 np.percentile(ordered_metric, 10),
                 np.percentile(ordered_metric, 50),
                 np.percentile(ordered_metric, 90)))
def print_metrics ( metrics , weights , prefix = '' ) : ordered_weights = [ weights [ c ] for c in sorted ( weights ) ] metric_names = metrics_writer . get_metrics_names ( metrics ) to_ret = None for metric in metric_names : ordered_metric = [ metrics [ c ] [ metric ] for c in sorted ( metrics ) ] print ( '%s: %g, 10th percentile: %g, 50th percentile: %g, 90th percentile %g' % ( prefix + metric , np . average ( ordered_metric , weights = ordered_weights ) , np . percentile ( ordered_metric , 10 ) , np . percentile ( ordered_metric , 50 ) , np . percentile ( ordered_metric , 90 ) ) )