from sft.eval.Evaluator import Evaluator
import os

LOG_PATH = "tmp/logs"
EXPERIMENT = sorted(os.listdir(LOG_PATH))[-1]  # use newest directory by alphanumerical ordering
WORLD_DIR = "world"
AGENTS_DICT = {
	"No AH": "agent_1_no_ah",
	"Short AH": "agent_2_short_ah",
	"Sum AH": "agent_3_sum_ah",
	"Avg AH": "agent_4_avg_ah",
	"Avg AH hid": "agent_5_avg_ah_hid",
}

# results
SLIDING_MEAN_WINDOW = 50

# paths
PLOT_EVERY_KTH_EPOCH = 50
NUM_PLOT_PATHS_IN_ROW = 3

EXPERIMENT_PATH = os.path.join(LOG_PATH, EXPERIMENT)
print("Evaluating {0}".format(EXPERIMENT_PATH))
# create evaluator
evaluator = Evaluator(EXPERIMENT_PATH, WORLD_DIR, AGENTS_DICT)
if False:
	print("Create path animation")
	# only possible if paths already extracted
	evaluator.animate_epoch("agent", 1975, "q.tsv")
else:
	print("Evaluate results")
	evaluator.plot_results(AGENTS_DICT.keys(), SLIDING_MEAN_WINDOW)
	print("Evaluate q-values")
	evaluator.plot_qs(AGENTS_DICT.keys(), "q.tsv")
	print("Evaluate epsilon-values")
	evaluator.plot_one_value_parameter(AGENTS_DICT.keys(), "epsilon.tsv")
	#evaluator.plot_expansive_spl_radius()
	print("Evaluate paths")
	# plot results, paths, qs
	evaluator.plot_paths(PLOT_EVERY_KTH_EPOCH, NUM_PLOT_PATHS_IN_ROW, "q.tsv", text_every_kth=10)

@@ -48,148 +48,536 @@
  os%0A
-%0ALOG_PATH = %22tmp/logs%22%0AEXPERIMENT = sorted(os.listdir(LOG_PATH))%5B-1%5D  # use newest directory by alphanumerical ordering%0AWORLD_DIR = %22world%22%0A
+from sft.log.AgentLogger import AgentLogger%0A%0ALOG_PATH = %22tmp/logs%22%0AEXPERIMENT = %2220170201-162649_exp_rmsprop_proprpl%22  # sorted(os.listdir(LOG_PATH))%5B-1%5D  # use newest directory by alphanumerical ordering%0AEXPERIMENT_PATH = os.path.join(LOG_PATH, EXPERIMENT)%0A%0Aif True:%0A%09AGENTS_DICT = %7B%7D%0A%09for fa in os.listdir(EXPERIMENT_PATH):%0A%09%09if fa.startswith(AgentLogger.LOG_AGENT_PREFIX):%0A%09%09%09agent_model_path = fa%0A%09%09%09agent_model_name = fa.split(AgentLogger.LOG_AGENT_PREFIX)%5B1%5D%5B1:%5D%0A%09%09%09AGENTS_DICT%5Bagent_model_name%5D = agent_model_path%0Aelse:%0A%09
 AGEN
@@ -588,16 +588,17 @@
 ICT = %7B%0A
+%09
 %09%22No AH%22
@@ -616,16 +616,17 @@
 no_ah%22,%0A
+%09
 %09%22Short 
@@ -650,16 +650,17 @@
 rt_ah%22,%0A
+%09
 %09%22Sum AH
@@ -676,24 +676,25 @@
 _3_sum_ah%22,%0A
+%09
 %09%22Avg AH%22: %22
@@ -710,16 +710,17 @@
 vg_ah%22,%0A
+%09
 %09%22Avg AH
@@ -748,16 +748,17 @@
 h_hid%22,%0A
+%09
 %7D%0A%0A# res
@@ -853,60 +853,166 @@
  3%0A%0A
-EXPERIMENT_PATH = os.path.join(LOG_PATH, EXPERIMENT)
+# get proper folders%0AWORLD_CONFIG_PATH = os.path.join(EXPERIMENT_PATH, %22world/world.py%22)%0AWORLDS_PATH = os.path.join(EXPERIMENT_PATH, %22world/world_init_logs%22)%0A
 %0Apri
@@ -1124,11 +1124,32 @@
 RLD_
-DIR
+CONFIG_PATH, WORLDS_PATH
 , AG
@@ -1495,32 +1495,34 @@
 silon-values%22)%0A%09
+# 
 evaluator.plot_o
@@ -1668,16 +1668,18 @@
 hs, qs%0A%09
+# 
 evaluato

fix evaluate-exp script to run with changed evaluator structure