From a8f1806f9a264766c4feed8c6eff6524507bf502 Mon Sep 17 00:00:00 2001 From: Vesna Tanko Date: Wed, 23 Oct 2024 14:38:42 +0200 Subject: [PATCH] Parameter Fitter: Report --- Orange/widgets/evaluate/owparameterfitter.py | 11 +++++++++++ .../widgets/evaluate/tests/test_owparameterfitter.py | 12 +++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Orange/widgets/evaluate/owparameterfitter.py b/Orange/widgets/evaluate/owparameterfitter.py index 0d10a3aa81..296c98694a 100644 --- a/Orange/widgets/evaluate/owparameterfitter.py +++ b/Orange/widgets/evaluate/owparameterfitter.py @@ -485,6 +485,17 @@ def onDeleteWidget(self): self.shutdown() super().onDeleteWidget() + def send_report(self): + if self._data is None or self._learner is None \ + or not self._learner.fitted_parameters(): + return + parameter = self.fitted_parameters[self.parameter_index].label + self.report_items("Settings", + [("Parameter", parameter), + ("Range", self.preview)]) + self.report_name("Plot") + self.report_plot() + def set_visual_settings(self, key: KeyType, value: ValueType): self.graph.parameter_setter.set_parameter(key, value) # pylint: disable=unsupported-assignment-operation diff --git a/Orange/widgets/evaluate/tests/test_owparameterfitter.py b/Orange/widgets/evaluate/tests/test_owparameterfitter.py index 0d54cf8641..bd757e8ee7 100644 --- a/Orange/widgets/evaluate/tests/test_owparameterfitter.py +++ b/Orange/widgets/evaluate/tests/test_owparameterfitter.py @@ -286,7 +286,17 @@ def assertFontEqual(self, font1: QFont, font2: QFont): self.assertEqual(font1.italic(), font2.italic()) def test_send_report(self): - self.assertEqual(1, 2) + self.widget.send_report() + + self.send_signal(self.widget.Inputs.data, self._housing) + self.send_signal(self.widget.Inputs.learner, self._pls) + self.wait_until_finished() + self.widget.send_report() + + self.send_signal(self.widget.Inputs.data, self._heart) + self.send_signal(self.widget.Inputs.learner, self._naive_bayes) + self.wait_until_finished() + self.widget.send_report() if __name__ == "__main__":