-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function to average results from multiple runs
- Loading branch information
1 parent
9c42b2f
commit 47af366
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
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,28 @@ | ||
import utils.formatting_utils as formatting_utils | ||
import utils.testing_utils as testing_utils | ||
|
||
|
||
def test_average_results(): | ||
# Prepare test data | ||
results_dict = { | ||
"dataset1_results": { | ||
"sae1": {"accuracy": 0.8, "loss": 0.5}, | ||
"sae2": {"accuracy": 0.75, "loss": 0.6}, | ||
}, | ||
"dataset2_results": { | ||
"sae1": {"accuracy": 0.85, "loss": 0.4}, | ||
"sae2": {"accuracy": 0.7, "loss": 0.65}, | ||
}, | ||
} | ||
dataset_names = ["dataset1", "dataset2"] | ||
|
||
# Expected output | ||
expected_output = { | ||
"sae1": {"accuracy": 0.825, "loss": 0.45}, | ||
"sae2": {"accuracy": 0.725, "loss": 0.625}, | ||
} | ||
|
||
# Call the function | ||
output = formatting_utils.average_results_dictionaries(results_dict, dataset_names) | ||
|
||
testing_utils.compare_dicts_within_tolerance(output, expected_output, tolerance=1e-6) |
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