import numpy as np
import matplotlib.pyplot as plt
data2 = np.load('Bilevel_exp/mnist_exp/AID_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.2_q_3_ite_200/1.npy')
data4 = np.load('Bilevel_exp/mnist_exp/BA-CG_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.2_q_3_ite_200/1.npy')
data5 =  np.load('Bilevel_exp/mnist_exp/ITD_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.2_q_3_ite_200/1.npy')
data6 = np.load('Bilevel_exp/mnist_exp/RAHGD_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.2_q_3_ite_200/1.npy')
data18 = np.load('Bilevel_exp/mnist_exp/RAGD-GS_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.2_q_3_ite_200/1.npy')
data19 = np.load('Bilevel_exp/mnist_exp/F2BA_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.2_q_3_ite_200/1.npy')


## plot train loss
plt.rcParams['figure.figsize'] = (8.0, 6.0)
plt.plot(data18[:26, 2], data18[:26, 0], 'k-.', label='RAGD-GS')
plt.plot(data2[:35, 2], data2[:35, 0], 'g-x', label='AID-BiO')
plt.plot(data4[:40, 2], data4[:40, 0], 'y-*', label='BA-CG')
plt.plot(data5[:6, 2], data5[:6, 0], 'c-d', label='ITD-BiO')
plt.plot(data6[:35, 2], data6[:35, 0], 'm--p', label='RAHGD')
plt.plot(data19[:10, 2], data19[:10, 0], 'b-o', label='F2BA')


plt.xlabel('running time  (s)', fontsize=20)
plt.ylabel('Train Loss', fontsize=20)
plt.legend(fontsize=18, loc=1)
plt.tick_params(labelsize=15)
plt.grid(True)
plt.xlim(0, 150)
plt.savefig('data_cleaning_02_train.eps', format='eps')
plt.show(block=True)





data12 = np.load('Bilevel_exp/mnist_exp/AID_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.4_q_3_ite_200/1.npy')
data14 = np.load('Bilevel_exp/mnist_exp/BA-CG_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.4_q_3_ite_200/1.npy')
data15 = np.load('Bilevel_exp/mnist_exp/ITD_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.4_q_3_ite_200/1.npy')
data16 = np.load('Bilevel_exp/mnist_exp/RAHGD_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.4_q_3_ite_200/1.npy')
data18 = np.load('Bilevel_exp/mnist_exp/RAGD-GS_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.4_q_3_ite_200/1.npy')
data19 = np.load('Bilevel_exp/mnist_exp/F2BA_20000_bs_20000_olr_0.1_ilr_0.1_eta_0.5_noiser_0.4_q_3_ite_200/1.npy')

plt.plot(data18[:23, 2], data18[:23, 0], 'k-.', label='RAGD-GS')
plt.plot(data16[:15, 2], data16[:15, 0], 'm--p', label='RAHGD')
plt.plot(data12[:19, 2], data12[:19, 0], 'g-x', label='AID-BiO')
plt.plot(data14[:47, 2], data14[:47, 0], 'y-*', label='BA-CG')
plt.plot(data15[:22, 2], data15[:22, 0], 'c-d', label='ITD-BiO')
plt.plot(data19[:15, 2], data19[:15, 0], 'b-o', label='F2BA')

plt.xlabel('running time  (s)', fontsize=20)
plt.ylabel('Train Loss', fontsize=20)
plt.legend(fontsize=18, loc=1)
plt.tick_params(labelsize=15)
plt.xlim(0, 150)
plt.grid(True)
plt.savefig('data_cleaning_04_train.eps', format='eps')
plt.show(block=True)