@@ -76,37 +76,40 @@ def _get_experiment_names() -> list[str]:
7676 ]
7777
7878
79- @app .route ("/n_fewest_steps_since_led_to_something_new_go_explore " , methods = ["GET" ])
80- def n_fewest_steps_since_led_to_something_new_go_explore_plot_data ():
79+ @app .route ("/go_explore " , methods = ["GET" ])
80+ def go_explore_plot_data ():
8181 """
8282 Provides plot data for the n states that have most recently seen a new cell.
8383 """
8484 n = _get_int_or_default ("n" , 10 )
85- _CACHE_ENTRY_DATABASE = list (
85+ _OCCURRENCE_LOG_ENTRIES = list (
8686 read_object_log (os .path .join (_LOG_DIR , "go_explore" , "state_cache-6.pkl" ))
8787 )
88- print (_CACHE_ENTRY_DATABASE )
88+
89+ caches = [cache .object ._cache .values () for cache in _OCCURRENCE_LOG_ENTRIES ]
90+ cache_entries = [cache_entry for cache in caches for cache_entry in cache ]
91+ _CACHE_ENTRY_DATABASE = CacheEntryDatabase (cache_entries )
8992
9093 return {
9194 "states" : [
92- cache_entry .object . state
95+ cache_entry .state_representative
9396 for cache_entry in _CACHE_ENTRY_DATABASE .cache_entries
9497 ],
95- # "trajectory_length": _CACHE_ENTRY_DATABASE.get_top_n_by_sort_key(
96- # TrajectorySortKey, n
97- # ),
98- # "steps_since_led_to_something_new": _CACHE_ENTRY_DATABASE.get_top_n_by_sort_key(
99- # StepsSinceLedToSomethingNewSortKey, n
100- # ),
101- # "steps_since_led_to_something_new_reset_count": _CACHE_ENTRY_DATABASE.get_top_n_by_sort_key(
102- # StepsSinceLedToSomethingNewResetCountSortKey, n
103- # ),
104- # "sample_count": _CACHE_ENTRY_DATABASE.get_top_n_by_sort_key(
105- # SampleCountSortKey, n
106- # ),
107- # "visit_count": _CACHE_ENTRY_DATABASE.get_top_n_by_sort_key(
108- # VisitCountSortKey, n
109- # ),
98+ "trajectory_length" : _CACHE_ENTRY_DATABASE .get_top_n_by_sort_key (
99+ TrajectorySortKey () , n
100+ ),
101+ "steps_since_led_to_something_new" : _CACHE_ENTRY_DATABASE .get_top_n_by_sort_key (
102+ StepsSinceLedToSomethingNewSortKey () , n
103+ ),
104+ "steps_since_led_to_something_new_reset_count" : _CACHE_ENTRY_DATABASE .get_top_n_by_sort_key (
105+ StepsSinceLedToSomethingNewResetCountSortKey () , n
106+ ),
107+ "sample_count" : _CACHE_ENTRY_DATABASE .get_top_n_by_sort_key (
108+ SampleCountSortKey () , n
109+ ),
110+ "visit_count" : _CACHE_ENTRY_DATABASE .get_top_n_by_sort_key (
111+ VisitCountSortKey () , n
112+ ),
110113 }
111114
112115
0 commit comments