domain_mapping/analysis/graph_top1_curves.py

60 lines
2.0 KiB
Python

# %%
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# %%
data_path = '../loss_comparisons_without_augmentation/top1_curves/baseline_output.txt'
df = pd.read_csv(data_path, header=None)
y = df[0]
plt.plot(y)
# Find the max value
max_y = np.max(y) # Max value
max_x = np.argmax(y) # x value corresponding to the max y
# Annotate the max value on the plot
# plt.annotate(f'Max: {max_y:.5f}', # Text to display
# xy=(max_x, max_y), # Point to annotate
# xytext=(max_x+0.7, max_y-0.3), # Location of text
# arrowprops=dict(facecolor='black',arrowstyle='->'),
# bbox=dict(boxstyle="round,pad=0.3", edgecolor='black', facecolor='yellow'))
# data_path = '../experimental/top1_curves/character_output.txt'
# df = pd.read_csv(data_path, header=None)
# y = df[0]
# plt.plot(y)
# max_y = np.max(y) # Max value
# max_x = np.argmax(y) # x value corresponding to the max y
# # Annotate the max value on the plot
# plt.annotate(f'Max: {max_y:.5f}', # Text to display
# xy=(max_x, max_y), # Point to annotate
# xytext=(max_x+0.7, max_y-0.2), # Location of text
# arrowprops=dict(facecolor='black',arrowstyle='->'),
# bbox=dict(boxstyle="round,pad=0.3", edgecolor='black', facecolor='yellow'))
data_path = '../experimental/top1_curves/character_knn.txt'
df = pd.read_csv(data_path, header=None)
y = df[0]
plt.plot(y)
max_y = np.max(y) # Max value
max_x = np.argmax(y) # x value corresponding to the max y
# Annotate the max value on the plot
plt.annotate(f'Max: {max_y:.5f}', # Text to display
xy=(max_x, max_y), # Point to annotate
xytext=(max_x+0.7, max_y-0.4), # Location of text
arrowprops=dict(facecolor='black',arrowstyle='->'),
bbox=dict(boxstyle="round,pad=0.3", edgecolor='black', facecolor='yellow'))
plt.ylim(0.4,1)
# data_path = '../loss_comparisons_with_augmentations/top1_curves/smooth_output.txt'
# df = pd.read_csv(data_path, header=None)
# plt.plot(df[0])
# %%