diff --git a/deckard/base/experiment/experiment.py b/deckard/base/experiment/experiment.py index a7951a5d..15edb150 100644 --- a/deckard/base/experiment/experiment.py +++ b/deckard/base/experiment/experiment.py @@ -65,7 +65,9 @@ def __init__( ) if self.attack is not None: logger.info(f"Attack: {self.attack}") - adv_metrics = [f"adv_{metric}" for metric in metrics if not metric.startswith("adv_")] + adv_metrics = [ + f"adv_{metric}" for metric in metrics if not metric.startswith("adv_") + ] if "adv_train_time" in adv_metrics: adv_metrics.remove("adv_train_time") adv_metrics.append("adv_fit_time") diff --git a/examples/gzip/classifier_refactor.py b/examples/gzip/classifier_refactor.py index 2f15d216..ddf87ed7 100644 --- a/examples/gzip/classifier_refactor.py +++ b/examples/gzip/classifier_refactor.py @@ -1,7 +1,6 @@ from typing import Literal import logging import numpy as np -import pandas as pd import brotli import pickle import gzip @@ -15,7 +14,6 @@ from sklearn.base import BaseEstimator, TransformerMixin - logger = logging.getLogger(__name__) @@ -433,7 +431,6 @@ def fit_transform(self, X, y=None): return self.transform(X) - if __name__ == "__main__": _config = """ diff --git a/examples/gzip/plots.py b/examples/gzip/plots.py index 541e3bd3..225c9dcc 100644 --- a/examples/gzip/plots.py +++ b/examples/gzip/plots.py @@ -1,9 +1,7 @@ import pandas as pd from tqdm import tqdm import seaborn as sns -import numpy as np from pathlib import Path -from matplotlib.ticker import FixedLocator, NullFormatter # Set seaborn theme to paper using times new roman font sns.set_theme(context="paper", style="whitegrid", font="Times New Roman", font_scale=2) @@ -39,7 +37,7 @@ data = data.fillna(0) print(f"Shape of data: {data.shape}") print(f"Columns: {data.columns}") - data['accuracy'] = data['accuracy'] * 100 + data["accuracy"] = data["accuracy"] * 100 tmp_groups = [] for col in group_these: if col not in data.columns: @@ -66,7 +64,9 @@ # add the mean and standard deviation to the group group[col + "_mean"] = mean group[col + "_std"] = std - assert f"{col}_mean" in group.columns, f"{col}_mean not in group columns" + assert ( + f"{col}_mean" in group.columns + ), f"{col}_mean not in group columns" assert f"{col}_std" in group.columns, f"{col}_std not in group columns" group = group.drop(col, axis=1) # group = group.head(1) @@ -233,7 +233,7 @@ refit_df = pd.read_csv("output/combined/plots/refit_merged.csv", index_col=0) refit_df["Algorithm"] = refit_df["algorithm"] - refit_df['accuracy'] = refit_df['accuracy'] * 100 + refit_df["accuracy"] = refit_df["accuracy"] * 100 refit_df.dropna(inplace=True, subset=["accuracy"]) acc_graph = sns.relplot( data=refit_df, @@ -249,7 +249,7 @@ hue_order=["Vanilla", "Assumed", "Enforced", "Average"], style_order=["GZIP", "BZ2", "Brotli", "Hamming", "Ratio", "Levenshtein"], ) - + for ax in acc_graph.axes.flat: # Increase the line thickness for line in ax.lines: @@ -259,7 +259,7 @@ label.set_rotation(45) # set ylim to [0,1] ax.set_ylim(0, 100) - + acc_graph.set_axis_labels("No. of Training Samples", " Accuracy (%)") acc_graph.set_titles("{row_name} - {col_name}") # acc_graph.tight_layout()