Ejemplo n.º 1
0
labels = len(G1) * [r"Graph $t_1$"] + len(G2) * [r"Graph $t_2$"]

plot_df = pd.DataFrame(data=Xhat_full, columns=["0", "1"])
plot_df["labels"] = labels
# ax.scatter(Xhat1[:25, 0], Xhat1[:25, 1], marker="s", c=colors[0], label="Graph 1, Block 1")
# ax.scatter(Xhat1[25:, 0], Xhat1[25:, 1], marker="o", c=colors[0], label="Graph 1, Block 2")
# ax.scatter(Xhat2[:25, 0], Xhat2[:25, 1], marker="s", c=colors[1], label="Graph 2, Block 1")
# ax.scatter(Xhat2[25:, 0], Xhat2[25:, 1], marker="o", c=colors[1], label="Graph 2, Block 2")
# ax.legend()

sns.scatterplot(data=plot_df, x="0", y="1", hue="labels", s=100)
ax.set(
    xlabel="Embedding dimension 1", ylabel="Embedding dimension 2", xticks=[], yticks=[]
)
sns.move_legend(ax, "upper right", title=None)

# Plot lines between matched pairs of points
for i in range(sum(n)):
    ax.plot(
        [Xhat1[i, 0], Xhat2[i, 0]],
        [Xhat1[i, 1], Xhat2[i, 1]],
        "black",
        alpha=0.15,
        zorder=-1,
    )


i = 20
mean_x = np.mean([Xhat1[i, 0], Xhat2[i, 0]])
mean_y = np.mean([Xhat1[i, 1], Xhat2[i, 1]])
Ejemplo n.º 2
0
parser = argparse.ArgumentParser(description='PTS 07 CBW Demand Variation Plot')
parser.add_argument('-d','--device', help='Device name', dest='device_name', required=True)
args = parser.parse_args()

plt.rc('font', size=8)

filename = 'test07_main_averaged.csv'
sns.set_style("whitegrid")

dv_data = pd.read_csv(filename, sep = ';', header=0)
dv_data.sort_values('QD', inplace=True, ascending=True)
dv_data.QD = dv_data.QD.astype(str)

dv_plot = sns.relplot(data=dv_data, x='QD', y='IOPS', hue='TC', sort=False, kind='line', palette=sns.color_palette('plasma', 6))

sns.move_legend(
    dv_plot, "lower center",
    bbox_to_anchor=(0.5, -.15),
    ncol=3,
    title='TC',
    frameon=False,
)

dv_plot.fig.set_figwidth(8)
dv_plot.fig.set_figheight(4)
dv_plot.set(ylabel='IOPS')
dv_plot.set(xlabel='Queue depth')

dv_plot.savefig(str(args.device_name) + '_cbw_dv.svg', format='svg', transparent=True)
dv_plot.savefig(str(args.device_name) + '_cbw_dv.pdf', format='pdf')
Ejemplo n.º 3
0
            acc = accuracy_score(y_test, y_pred)
            macro_f1 = f1_score(y_test, y_pred, average="macro")
            row = {
                "split": split,
                "n_components": n_components,
                "accuracy": acc,
                "model": model.__class__.__name__,
                "macro_f1": macro_f1,
            }
            rows.append(row)

results = pd.DataFrame(rows)

#%%
from giskard.plot import set_theme

set_theme()
fig, ax = plt.subplots(1, 1, figsize=(10, 6))
sns.lineplot(data=results, x="n_components", y="accuracy", hue="model")
sns.move_legend(ax, "lower left", bbox_to_anchor=(0, 1), title=None, ncol=2)
ax.set_xlabel("# of dimensions")
ax.set_ylabel("Accuracy")
ax.set(xscale="log")

fig, ax = plt.subplots(1, 1, figsize=(10, 6))
sns.lineplot(data=results, x="n_components", y="macro_f1", hue="model")
sns.move_legend(ax, "lower left", bbox_to_anchor=(0, 1), title=None, ncol=2)
ax.set_xlabel("# of dimensions")
ax.set_ylabel("Macro F1")
ax.set(xscale="log")
Ejemplo n.º 4
0
               'State AB 2': 'tab:orange', 
               'State AB 3': 'tab:green',
               'State AB 5': 'tab:red',
               'State AB 10': 'tab:purple'}
              
hir_data = pd.read_csv(filename, sep = ';', header=0)
hir_data_melted = pd.melt(hir_data, id_vars=['Round', 'IOPS', 'STATE'], value_vars=['AVLAT', 'P99_LAT', 'P99D9_LAT', 'P99D99_LAT', 'MAX_LAT'], var_name='Latency type')

avlat_data = hir_data_melted.loc[hir_data_melted['Latency type'] == 'AVLAT']

hir_plot = sns.relplot(x='Round', y='value', hue='STATE', kind='scatter', data=avlat_data, palette=hue_colors, edgecolor=None, rasterized=True)

sns.move_legend(
    hir_plot, "lower center",
    bbox_to_anchor=(0.5, -.05),
    ncol=3,
    title=None,
    frameon=False,
)

hir_plot.fig.set_figwidth(15)
hir_plot.fig.set_figheight(7)
hir_plot.set(ylabel='Latency, µs')
hir_plot.set(xlabel='Time, min')
hir_plot.set(yscale='log')

hir_plot.savefig(str(args.device_name) + '_hir_latency.svg', format='svg', transparent=True)
hir_plot.savefig(str(args.device_name) + '_hir_latency.png', format='png')
hir_plot.savefig(str(args.device_name) + '_hir_latency.pdf', format='pdf')

p99d99_data = hir_data_melted.loc[hir_data_melted['Latency type'] == 'P99D99_LAT']
Ejemplo n.º 5
0
    data_dir_string = '/home/nilskk/rewe_project/data/penny'
    # data_dir_string = '/data/voc_fruit_weights'
    data_directory = Path(data_dir_string)
    input_directory = Path(os.path.join(data_dir_string, 'dataset_information'))
    output_directory = Path(os.path.join(data_dir_string, 'dataset_plots'))
    output_directory.mkdir(exist_ok=True, parents=True)

    file_dataframe = pd.read_pickle(os.path.join(input_directory, 'file_dataframe.pkl'))
    object_dataframe = pd.read_pickle(os.path.join(input_directory, 'object_dataframe.pkl'))

    sns.set_theme()

    # Anzahl Objekte pro Klasse Train/Test
    plt.figure(figsize=(8,8))
    ax = sns.boxenplot(data=file_dataframe, x='class', y='objects', hue='set')
    sns.move_legend(ax, loc='upper left', bbox_to_anchor=(1, 1))
    ax.yaxis.set_major_locator(ticker.MultipleLocator(1.0))
    ax.yaxis.set_major_formatter(ticker.ScalarFormatter())
    plt.xticks(rotation=40, ha="right")
    # plt.legend(bbox_to_anchor=(1.01, 1), borderaxespad=0)
    plt.xlabel('Klasse')
    plt.ylabel('Anzahl der Objekte pro Bild')
    plt.savefig(os.path.join(output_directory, 'objects_per_class.png'), bbox_inches='tight')

    # Anzahl Bilder pro Klasse Train/Test
    plt.figure(figsize=(8,8))
    ax = sns.countplot(data=file_dataframe, x='class', hue='set')
    sns.move_legend(ax, loc='upper left', bbox_to_anchor=(1, 1))
    plt.xticks(rotation=40, ha="right")
    # plt.legend(bbox_to_anchor=(1.01, 1), borderaxespad=0)
    plt.xlabel('Klasse')
Ejemplo n.º 6
0
sns.stripplot(x="value",
              y="measurement",
              hue="species",
              data=iris,
              dodge=True,
              alpha=.25,
              zorder=1,
              legend=False)

# Show the conditional means, aligning each pointplot in the
# center of the strips by adjusting the width allotted to each
# category (.8 by default) by the number of hue levels
sns.pointplot(x="value",
              y="measurement",
              hue="species",
              data=iris,
              dodge=.8 - .8 / 3,
              join=False,
              palette="dark",
              markers="d",
              scale=.75,
              ci=None)

# Improve the legend
sns.move_legend(ax,
                loc="lower right",
                ncol=3,
                frameon=True,
                columnspacing=1,
                handletextpad=0)
Ejemplo n.º 7
0
    wsat_data,
    id_vars=['Round', 'TGib', 'TDF'],
    value_vars=['Average', '99%', '99.9%', '99.99%', 'Maximum'],
    var_name='Latency type')

wsat_plot = sns.relplot(x='TDF',
                        y='value',
                        hue='Latency type',
                        kind='line',
                        data=wsat_data_lat_melted,
                        palette=sns.color_palette('plasma', 5))

sns.move_legend(
    wsat_plot,
    "lower center",
    bbox_to_anchor=(0.5, -.1),
    ncol=3,
    title=None,
    frameon=False,
)

wsat_plot.fig.set_figwidth(8)
wsat_plot.fig.set_figheight(4)
wsat_plot.set(ylabel='Latency, µs')
wsat_plot.set(xlabel='Drive fills')
wsat_plot.set(yscale='log')
wsat_plot.set(xlim=(0, None))

wsat_plot.savefig(str(args.device_name) + '_wsat_latency.svg',
                  format='svg',
                  transparent=True)
wsat_plot.savefig(str(args.device_name) + '_wsat_latency.pdf', format='pdf')
Ejemplo n.º 8
0
new_labels = [
    "Parameterization",
    'softmax',
    'low-rank',
    "Num states",
    "1024",
    "2048",
    "4096",
    "8192",
    "16384",
]
sns.move_legend(
    g,
    "right",
    #"lower center",
    bbox_to_anchor=(1.1, 0.65),
    ncol=1,
    title=None,
    frameon=False,
)
for t, l in zip(g.legend.texts, new_labels):
    t.set_text(l)
ax = g.axes[0][0]
ax.set_xscale("log", base=2)
#ax.set_yscale("log", base=2)
g.tight_layout()
g.savefig("lhmm-speed-accuracy.png")

g = sns.relplot(
    data=hmm_df,
    x="speed",