Skip to content

Commit

Permalink
adding table of summary statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
JBris committed Sep 12, 2024
1 parent b646509 commit d0d45f3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions deeprootgen/pipeline/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from ..data_model import RootSimulationModel
from ..model import RootSystemSimulation
from ..statistics import get_summary_statistic_func, get_summary_statistics

OUT_DIR = osp.join("/app", "outputs")

Expand Down Expand Up @@ -196,6 +197,28 @@ def log_simulation(
metric_df.to_csv(outfile, index=False)
mlflow.log_artifact(outfile)

statistic_names = []
statistic_values = []
summary_statistics = get_summary_statistics()
for summary_statistic in summary_statistics:
statistic_name = summary_statistic["value"]
statistic_func = get_summary_statistic_func(statistic_name)
statistic_instance = statistic_func()
statistic_value = statistic_instance.calculate(node_df)

if isinstance(statistic_value, tuple):
continue
statistic_names.append(statistic_name)
statistic_values.append(statistic_value)
mlflow.log_metric(statistic_name, statistic_value)

statistic_df = pd.DataFrame(
{"statistic_name": statistic_names, "statistic_value": statistic_values}
)
outfile = osp.join(OUT_DIR, f"{time_now}-{task}_summary_statistics.csv")
statistic_df.to_csv(outfile, index=False)
mlflow.log_artifact(outfile)


def load_form_parameters(
list_of_contents: list, list_of_names: list, form_name: str, task: str = ""
Expand Down

0 comments on commit d0d45f3

Please sign in to comment.