Commit 5652fb9c authored by Daniel Lukats's avatar Daniel Lukats

added color scheme and minor bug fixes to evaluation script

parent bf2e1011
......@@ -93,14 +93,15 @@ def create_plot(experiment: Experiment,
:param plot:
:return:
"""
colors = ['#0077BB', '#33BBEE', '#009988', '#EE7733']
setup()
data_x = []
data_y = []
for i, run in enumerate(experiment.runs):
plt.scatter(run.steps, run.values, label=f'Run {i}')
plt.scatter(run.steps, run.values, label=f'Run {i+1}', color=colors[i])
data_x += run.steps
data_y += run.values
plt.plot(comparison[0], comparison[1], c='black', label='Trendline')
plt.plot(comparison[0], comparison[1], color='black', label='Trendline')
plt.title(f'{experiment.game}')
plt.xlabel('Time step')
plt.ylabel('Score')
......@@ -111,9 +112,9 @@ def create_plot(experiment: Experiment,
path = os.path.join(experiment.path, experiment.game)
plt.savefig(path)
if default_trend is not None:
plt.plot(default_trend[0], default_trend[1], c='red', label='Trendline (default config)')
plt.plot(default_trend[0], default_trend[1], label='Trendline (default config)', color=colors[3])
plt.legend()
plt.savefig(os.path.join(path, '_default'))
plt.savefig(path + '_default')
plt.clf()
......@@ -193,14 +194,16 @@ def create_default_config_trends(data_dir: str):
def main(root_dir: str,
default_config_dir: str,
default_config_dir: str = None,
):
"""
:param root_dir:
:return:
"""
trends = create_default_config_trends(default_config_dir)
trends = None
if default_config_dir is not None:
trends = create_default_config_trends(default_config_dir)
experiments = os.listdir(root_dir)
print(f'Full list of experiments: {experiments}')
for experiment in experiments:
......@@ -223,11 +226,12 @@ def main(root_dir: str,
for d in data:
data[d].save()
data[d].score()
# comparison = create_trendline(data[d], 256)
comparison = create_trendline_isotonic(data[d])
comparison = create_trendline(data[d], 256)
data[d].smooth()
# create_plot(data[d], plot=True)
create_plot(data[d], comparison, trends[d])
if trends is not None:
create_plot(data[d], comparison, trends[d])
else:
create_plot(data[d], comparison)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment