'''
    This script is specially designed to draw accuracy in incremental learning
'''

import pandas as pd
import matplotlib.pyplot as plt


# Numtask=5
# learning_subtasks = [20, 40, 60, 79, 98]
# eeil = [0.962264,0.871666,0.829063,0.808117,0.782558]
# eeil_stream = [0.933962,0.831250,0.755838,0.743875,0.743852]
# fine_tuning = [0.962264,0.645374,0.460435,0.237705,0.194074] 
# joint = [0.962264,0.933782,0.914404,0.898062,0.899212]
# eeil_hf_stream = [0.955975,0.851491,0.818802,0.794362,0.774354]
# eeil_if_stream = [0.953, 0.864, 0.793, 0.780, 0.750]

# Numtask=10
# learning_subtasks = [10, 20, 30, 40, 50, 60, 70, 80, 89, 98]
# eeil = [0.987578,0.806900,0.697796,0.852081,0.796192,0.769197,0.772097,0.721424,0.651643,0.716154]
# eeil_stream = [0.993789,0.828401,0.681386,0.714240,0.730022,0.747428,0.754909,0.744496,0.733012,0.744165]
# joint = [0.987578,0.952783,0.937596,0.941842,0.935549,0.931263,0.913016,0.910139,0.922574,0.906227]
# eeil_hf_stream = [0.993789,0.853642,0.831579,0.785323,0.770694,0.749697,0.777550,0.762764,0.706798,0.749713]
# fine_tuning = [0.987578,0.430075,0.402990,0.238326,0.253507,0.194474,0.128852,0.153763,	0.131258,0.137500]
# eeil_if_stream = [0.987578,0.866064,0.776552,0.772575,0.784182,0.770409,0.774215,0.767366	,0.714723,0.742302]

# Numtask = 12
learning_subtasks = [7, 14, 21, 28, 35, 42, 49, 56, 62, 68, 74, 80, 86, 92, 98]
eeil = [0.991304,0.782609,0.796060,0.812976,0.836121,0.829547,0.814248,0.775573,0.739728,0.792055,0.759215,0.751868,0.733225,0.745430,0.737409]
eeil_stream = [1.000000,0.869565,0.846398,0.819409,0.855490,0.836037,0.823089,0.791923,0.736627,0.766376,0.771543,0.746359,0.707289,0.721382,0.732087]
joint = [0.991304,0.991304,0.916290,0.943091,0.951059,0.924611,0.918367,0.907724,0.875867,0.904262,0.898709,0.896864,0.916820,0.910690,0.907921]
fine_tuning = [0.991304,0.499221,0.316800,0.263735,0.180160,0.160317,0.052783,0.132178,0.058932,0.068189,	0.049574,0.077607,0.061856,0.059190,0.084234]
eeil_if_stream = [1.000000,0.943478,0.882968,0.851051,0.863293,0.828117,0.819057,0.799822,0.753624	,0.771862,0.739318,0.762233,0.715227,0.690976,0.699943]
eeil_hf_stream = [1.000000,0.825718,0.868579,0.807962,0.851202,0.848701,0.814319,0.814826,0.756670,0.778561,0.729015,0.770304,0.761158,0.732702,0.737809]



df = pd.DataFrame(list(zip(eeil , eeil_if_stream, joint, fine_tuning)),
                  index = learning_subtasks, 
                  columns = ['EEIL', 'EEIL + Stream Histogram + Intermediate Fusion','Joint-Training', 'Basic Fine-tuning'])

ax = df.plot(xticks=learning_subtasks,title='Top 1 Accuracy on '+str(len(learning_subtasks))+' tasks CIL', fontsize=10)
ax.set(xlabel='Num classes', ylabel='Top-1-Accuracy')

name_fig = 'results_plot_stream_compare_baseline_'+str(len(learning_subtasks))+'.png'
ax.figure.savefig(name_fig)

