-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
876 additions
and
224 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import json | ||
|
||
|
||
def check_for_absolutes(data): | ||
for env_name in data: | ||
for task_name in data[env_name]: | ||
for algo_name in data[env_name][task_name]: | ||
for seed in data[env_name][task_name][algo_name]: | ||
if ( | ||
"absolute_metrics" | ||
not in data[env_name][task_name][algo_name][seed] | ||
): | ||
print( | ||
f"Found absolute metrics not in {env_name}/{task_name}/{algo_name}/{seed}" | ||
) | ||
elif ( | ||
"absolute_metrics" in data[env_name][task_name][algo_name][seed] | ||
# and "sac" in algo_name | ||
): | ||
print( | ||
f"Found absolute metrics in {env_name}/{task_name}/{algo_name}/{seed}" | ||
) | ||
|
||
|
||
in_file_path = "data/biggest-benchmark-sac/merged_data/metrics_winrate_processed.json" | ||
with open(in_file_path, "r") as file: | ||
data = json.load(file) | ||
|
||
check_for_absolutes(data) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import json | ||
|
||
|
||
def filter_json(data, tasks_to_keep): | ||
filtered_data = {} | ||
for env_name, env_tasks in data.items(): | ||
kept_tasks = { | ||
task: info for task, info in env_tasks.items() if task in tasks_to_keep | ||
} | ||
if kept_tasks: | ||
filtered_data[env_name] = kept_tasks | ||
return filtered_data | ||
|
||
|
||
base_folder_name = "biggest-benchmark-sac" | ||
|
||
# Example usage: | ||
input_file = f"./data/{base_folder_name}/merged_data/metrics_winrate_processed.json" | ||
output_file = f"./data/{base_folder_name}/merged_data/metrics_seed_processed.json" | ||
tasks_to_keep = [ | ||
"hopper_3x1", | ||
"halfcheetah_6x1", | ||
"walker2d_2x3", | ||
"ant_4x2", | ||
# "humanoid_9|8", | ||
] # Replace with your list of tasks to keep | ||
|
||
# Read the input JSON file | ||
with open(input_file, "r") as f: | ||
data = json.load(f) | ||
|
||
# Filter the data | ||
filtered_data = filter_json(data, tasks_to_keep) | ||
|
||
# Write the filtered data to the output JSON file | ||
with open(output_file, "w") as f: | ||
json.dump(filtered_data, f, indent=2) | ||
|
||
print(f"Filtered data has been written to {output_file}") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.