save to files
This commit is contained in:
+12
-8
@@ -5,7 +5,7 @@ import matplotlib.pyplot as plt
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
def total_boxplot(DATA, creator = 'any', tester = 'any', simulation = "dummy simulation"):
|
def total_boxplot(DATA, creator = 'any', tester = 'any', simulation = "dummy_simulation", savepath = "./"):
|
||||||
|
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
|
|
||||||
@@ -59,8 +59,10 @@ def total_boxplot(DATA, creator = 'any', tester = 'any', simulation = "dummy sim
|
|||||||
ax.set(xlabel=xlabel, ylabel='Score')
|
ax.set(xlabel=xlabel, ylabel='Score')
|
||||||
ax.set_title(title)
|
ax.set_title(title)
|
||||||
|
|
||||||
|
ax.figure.savefig(f'{savepath}/{creator}_{tester}_{simulation}.png', bbox_inches='tight')
|
||||||
|
|
||||||
def heat_map(DATA, criteria = np.median):
|
|
||||||
|
def heat_map(DATA, criteria = np.median, savepath = "./"):
|
||||||
|
|
||||||
names_to_nums = {name: num for num, name in enumerate(list(DATA.keys()))}
|
names_to_nums = {name: num for num, name in enumerate(list(DATA.keys()))}
|
||||||
values = np.zeros( (len(names_to_nums)+1, len(names_to_nums)+1) )
|
values = np.zeros( (len(names_to_nums)+1, len(names_to_nums)+1) )
|
||||||
@@ -94,7 +96,9 @@ def heat_map(DATA, criteria = np.median):
|
|||||||
ax.set_yticks(range(len(DATA.keys())+1), labels=list(DATA.keys())+['mean'] )
|
ax.set_yticks(range(len(DATA.keys())+1), labels=list(DATA.keys())+['mean'] )
|
||||||
|
|
||||||
ax.set(xlabel='tester', ylabel='creator')
|
ax.set(xlabel='tester', ylabel='creator')
|
||||||
ax.set_title("Cross-validation heatmap")
|
ax.set_title(f"Cross-validation heatmap ({criteria.__name__})")
|
||||||
|
|
||||||
|
ax.figure.savefig(f"{savepath}/cross_validation_{criteria.__name__}.png")
|
||||||
|
|
||||||
|
|
||||||
def convert_score(data):
|
def convert_score(data):
|
||||||
@@ -150,15 +154,15 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
#for cr, data in DATA.items():
|
#for cr, data in DATA.items():
|
||||||
#print(f"{cr}: {data}")
|
#print(f"{cr}: {data}")
|
||||||
|
savepath = global_path
|
||||||
total_boxplot(DATA, creator = 'any', tester = 'any')
|
total_boxplot(DATA, creator = 'any', tester = 'any', savepath = savepath)
|
||||||
|
|
||||||
for name in DATA.keys():
|
for name in DATA.keys():
|
||||||
|
|
||||||
total_boxplot(DATA, creator = name, tester = 'any')
|
total_boxplot(DATA, creator = name, tester = 'any', savepath = savepath)
|
||||||
total_boxplot(DATA, creator = 'any', tester = name)
|
total_boxplot(DATA, creator = 'any', tester = name, savepath = savepath)
|
||||||
|
|
||||||
heat_map(DATA)
|
heat_map(DATA, savepath = savepath)
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user