From 3b9fd29a4b66f9929282d5368ba86c9e3e638267 Mon Sep 17 00:00:00 2001 From: poojanilangekar Date: Thu, 27 Jul 2023 17:37:06 -0700 Subject: [PATCH] bugfix: Process result files of the form (metric, value) as dictionaries or scalar with the column name score (#460) The LocalEnv.run() function processed any results DataFrame containing a single record as a scalar record. This change ensures that even if the result file contains a single line of the form `(metric, value)`, it is processed as a dictionary. --------- Co-authored-by: Sergiy Matusevych --- mlos_bench/mlos_bench/environments/local/local_env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlos_bench/mlos_bench/environments/local/local_env.py b/mlos_bench/mlos_bench/environments/local/local_env.py index 38a09c72d1..2f72fc1f16 100644 --- a/mlos_bench/mlos_bench/environments/local/local_env.py +++ b/mlos_bench/mlos_bench/environments/local/local_env.py @@ -155,7 +155,7 @@ def run(self) -> Tuple[Status, Optional[dict]]: self._read_results_file, extra_paths=[temp_dir])) _LOG.debug("Read data:\n%s", data) - if len(data) != 1: + if list(data.columns) == ["metric", "value"]: _LOG.warning( "Local run has %d rows: assume long format of (metric, value)", len(data)) data = pandas.DataFrame([data.value.to_list()], columns=data.metric.to_list())