Skip to content

Commit

Permalink
fix eval table
Browse files Browse the repository at this point in the history
  • Loading branch information
smellycloud committed Jan 14, 2025
1 parent f4cdb2b commit 24e9ef0
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions views_pipeline_core/managers/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,14 @@ def _generate_evaluation_table(self, metric_dict: Dict) -> str:
table_str = f"{'Metric':<25} | {'Value':<15}\n"
table_str += "-" * 45 + "\n"
for key, value in metric_dict.items():
table_str += f"{key:<25} | {value:<15}\n"
return table_str
try:
if not str(key).startswith("_"):
value = float(value) # Super hacky way to filter out metrics. 0/10 do not recommend
table_str += f"{key:<25} | {value:<15.6f}\n"
except:
continue
return f"```\n{table_str}```"


def _save_model_artifact(self, run_type):
"""
Expand Down Expand Up @@ -1321,22 +1327,14 @@ def _handle_log_creation(self, train: bool, eval: bool, forecast: bool) -> None:
self._model_path.data_raw
/ f"{self.config['run_type']}_data_fetch_log.txt"
).get("Data Fetch Timestamp", None)
if train:
create_log_file(
path_generated=self._model_path.data_generated,
model_config=self.config,
model_timestamp=self.config["timestamp"],
data_generation_timestamp=None,
data_fetch_timestamp=data_fetch_timestamp,
)
else:
create_log_file(
path_generated=self._model_path.data_generated,
model_config=self.config,
model_timestamp=self.config["timestamp"],
data_generation_timestamp=timestamp,
data_fetch_timestamp=data_fetch_timestamp,
)

create_log_file(
path_generated=self._model_path.data_generated,
model_config=self.config,
model_timestamp=self.config["timestamp"],
data_generation_timestamp= None if train else timestamp,
data_fetch_timestamp=data_fetch_timestamp,
)


def _evaluate_prediction_dataframe(self, df_predictions):
Expand Down Expand Up @@ -1412,7 +1410,7 @@ def _evaluate_prediction_dataframe(self, df_predictions):
# else:
self._wandb_alert(
title=f"Evaluation Complete for model {self.config['name']}",
text=f"{str(wandb.run.summary._as_dict())}",
text=f"{self._generate_evaluation_table(metric_dict=wandb.run.summary._as_dict())}",
)

@abstractmethod
Expand Down

0 comments on commit 24e9ef0

Please sign in to comment.