From c13560c77164ec4b17c77bd8c38945b397cc8f68 Mon Sep 17 00:00:00 2001 From: "Martindale, Nathan" Date: Wed, 26 Apr 2023 11:01:43 -0400 Subject: [PATCH] Fix reportables not using correct name in render function Fixes #46 --- CHANGELOG.md | 9 +++++++++ curifactory/__init__.py | 2 +- curifactory/reporting.py | 8 ++++---- examples/minimal/experiments/newsgroups.py | 2 ++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 271bb28..9a28608 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.13.1] - 2023-04-26 + +### Fixed +* Reportables that implement render using the old `name` instead of `qualified_name`, causing + unintended figure image overwrites. + + + + ## [0.13.0] - 2023-04-21 ### Added diff --git a/curifactory/__init__.py b/curifactory/__init__.py index 75454e7..ab7846e 100644 --- a/curifactory/__init__.py +++ b/curifactory/__init__.py @@ -32,4 +32,4 @@ stage, ) -__version__ = "0.13.0" +__version__ = "0.13.1" diff --git a/curifactory/reporting.py b/curifactory/reporting.py index 1fbdbff..ce6f17a 100644 --- a/curifactory/reporting.py +++ b/curifactory/reporting.py @@ -232,11 +232,11 @@ def render(self): if "format" not in self.kwargs: self.kwargs["format"] = "png" self.fig.savefig( - f"{self.path}/{self.name}.{self.kwargs['format']}", **self.kwargs + f"{self.path}/{self.qualified_name}.{self.kwargs['format']}", **self.kwargs ) def html(self): - return f"" + return f"" class LinePlotReporter(Reportable): @@ -315,13 +315,13 @@ def render(self): if "format" not in self.savefig_kwargs: self.savefig_kwargs["format"] = "png" fig.savefig( - f"{self.path}/{self.name}.{self.savefig_kwargs['format']}", + f"{self.path}/{self.qualified_name}.{self.savefig_kwargs['format']}", **self.savefig_kwargs, ) plt.close() def html(self): - return f"" + return f"" def render_report_head(manager) -> list[str]: diff --git a/examples/minimal/experiments/newsgroups.py b/examples/minimal/experiments/newsgroups.py index bae288b..5d2122f 100644 --- a/examples/minimal/experiments/newsgroups.py +++ b/examples/minimal/experiments/newsgroups.py @@ -44,6 +44,8 @@ def train_model(record, training_data): clf = MLPClassifier(args.layers, activation=args.activation).fit( training_data[0], training_data[1] ) + + record.report(LinePlotReporter(clf.loss_curve_, name="loss")) return clf