Safe PFL Plotter Module

A class to parse log files and visualize test accuracy trends for nodes over multiple rounds.

This class reads a log file, extracts test accuracy data for each node, and generates a plot to visualize the trends. It also supports plotting mean and standard deviation of test accuracies across all nodes.

Attributes:

log_path (str): Path to the log file containing test accuracy data.

plot_result_path (str): Path to save the generated plot (optional).

distinct_colors (bool): Whether to use distinct colors for each node’s plot.

all_test_accuracy_mean (bool): Whether to plot the mean test accuracy across all nodes.

all_test_accuracy_std (bool): Whether to plot the standard deviation of test accuracies.

colors (list): List of colors for plotting, generated dynamically if distinct_colors is True.

node_test_acc (dict): Dictionary where keys are node IDs and values are lists of test accuracies.