mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-26 17:13:09 +00:00
first commit
This commit is contained in:
commit
621d00dd80
89 changed files with 15315 additions and 0 deletions
19
atroposlib/utils/metrics.py
Normal file
19
atroposlib/utils/metrics.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import numpy as np
|
||||
|
||||
|
||||
def get_std_min_max_avg(name: str, data: list, metrics_dict: dict) -> dict:
|
||||
"""
|
||||
Calculate the standard deviation, minimum, maximum, and average of a list of numbers.
|
||||
Adds it to the wandb dict for logging.
|
||||
|
||||
Args:
|
||||
data (list): A list of numbers.
|
||||
|
||||
Returns:
|
||||
dict: A dictionary containing the standard deviation, minimum, maximum, and average.
|
||||
"""
|
||||
metrics_dict[f"{name}_mean"] = np.mean(data)
|
||||
metrics_dict[f"{name}_std"] = np.std(data)
|
||||
metrics_dict[f"{name}_max"] = np.max(data)
|
||||
metrics_dict[f"{name}_min"] = np.min(data)
|
||||
return metrics_dict
|
||||
Loading…
Add table
Add a link
Reference in a new issue