(stat_metrics, weighted=False, plot_stds=False,
        figsize=(10, 8), title_fontsize=16, **kwargs)
Plots the clients' average test accuracy vs. the round number.

    Args:
        stat_metrics: pd.DataFrame as written by writer.py.
        weighted: Whether the average across clients should be weighted by number of
            test samples.
        plot_stds: Whether to plot error bars corresponding to the std between users.
        figsize: Size of the plot as specified by plt.figure().
        title_fontsize: Font size for the plot's title.
        kwargs: Arguments to be passed to _set_plot_properties.
Plots the clients' average test accuracy vs. the round number.
Plots the clients average test accuracy vs . the round number .
def plot_accuracy_vs_round_number(stat_metrics, weighted=False, plot_stds=False,
        figsize=(10, 8), title_fontsize=16, **kwargs):
    """Plots the clients' average test accuracy vs. the round number.

    Args:
        stat_metrics: pd.DataFrame as written by writer.py.
        weighted: Whether the average across clients should be weighted by number of
            test samples.
        plot_stds: Whether to plot error bars corresponding to the std between users.
        figsize: Size of the plot as specified by plt.figure().
        title_fontsize: Font size for the plot's title.
        kwargs: Arguments to be passed to _set_plot_properties."""
    plt.figure(figsize=figsize)
    title_weighted = 'Weighted' if weighted else 'Unweighted'
    plt.title('Accuracy vs Round Number (%s)' % title_weighted, fontsize=title_fontsize)
    if weighted:
        accuracies = stat_metrics.groupby(NUM_ROUND_KEY).apply(_weighted_mean, ACCURACY_KEY, NUM_SAMPLES_KEY)
        accuracies = accuracies.reset_index(name=ACCURACY_KEY)

        stds = stat_metrics.groupby(NUM_ROUND_KEY).apply(_weighted_std, ACCURACY_KEY, NUM_SAMPLES_KEY)
        stds = stds.reset_index(name=ACCURACY_KEY)
    else:
        accuracies = stat_metrics.groupby(NUM_ROUND_KEY, as_index=False).mean()
        stds = stat_metrics.groupby(NUM_ROUND_KEY, as_index=False).std()

    if plot_stds:
        plt.errorbar(accuracies[NUM_ROUND_KEY], accuracies[ACCURACY_KEY], stds[ACCURACY_KEY])
    else:
        plt.plot(accuracies[NUM_ROUND_KEY], accuracies[ACCURACY_KEY])

    percentile_10 = stat_metrics.groupby(NUM_ROUND_KEY, as_index=False).quantile(0.1)
    percentile_90 = stat_metrics.groupby(NUM_ROUND_KEY, as_index=False).quantile(0.9)

    plt.plot(percentile_10[NUM_ROUND_KEY], percentile_10[ACCURACY_KEY], linestyle=':')
    plt.plot(percentile_90[NUM_ROUND_KEY], percentile_90[ACCURACY_KEY], linestyle=':')

    plt.legend(['Mean', '10th percentile', '90th percentile'], loc='upper left')

    plt.ylabel('Accuracy')
    plt.xlabel('Round Number')
    _set_plot_properties(kwargs)
    plt.show()
def plot_accuracy_vs_round_number ( stat_metrics , weighted = False , plot_stds = False , figsize = ( 10 , 8 ) , title_fontsize = 16 , * * kwargs ) : plt . figure ( figsize = figsize ) title_weighted = 'Weighted' if weighted else 'Unweighted' plt . title ( 'Accuracy vs Round Number (%s)' % title_weighted , fontsize = title_fontsize ) if weighted : accuracies = stat_metrics . groupby ( NUM_ROUND_KEY ) . apply ( _weighted_mean , ACCURACY_KEY , NUM_SAMPLES_KEY ) accuracies = accuracies . reset_index ( name = ACCURACY_KEY ) stds = stat_metrics . groupby ( NUM_ROUND_KEY ) . apply ( _weighted_std , ACCURACY_KEY , NUM_SAMPLES_KEY ) stds = stds . reset_index ( name = ACCURACY_KEY ) else : accuracies = stat_metrics . groupby ( NUM_ROUND_KEY , as_index = False ) . mean ( ) stds = stat_metrics . groupby ( NUM_ROUND_KEY , as_index = False ) . std ( ) if plot_stds : plt . errorbar ( accuracies [ NUM_ROUND_KEY ] , accuracies [ ACCURACY_KEY ] , stds [ ACCURACY_KEY ] ) else : plt . plot ( accuracies [ NUM_ROUND_KEY ] , accuracies [ ACCURACY_KEY ] ) percentile_10 = stat_metrics . groupby ( NUM_ROUND_KEY , as_index = False ) . quantile ( 0.1 ) percentile_90 = stat_metrics . groupby ( NUM_ROUND_KEY , as_index = False ) . quantile ( 0.9 ) plt . plot ( percentile_10 [ NUM_ROUND_KEY ] , percentile_10 [ ACCURACY_KEY ] , linestyle = ':' ) plt . plot ( percentile_90 [ NUM_ROUND_KEY ] , percentile_90 [ ACCURACY_KEY ] , linestyle = ':' ) plt . legend ( [ 'Mean' , '10th percentile' , '90th percentile' ] , loc = 'upper left' ) plt . ylabel ( 'Accuracy' ) plt . xlabel ( 'Round Number' ) _set_plot_properties ( kwargs ) plt . show ( )