diff --git a/skore/src/skore/sklearn/_estimator/base.py b/skore/src/skore/sklearn/_estimator/base.py index a619e9fe1..975ad8f20 100644 --- a/skore/src/skore/sklearn/_estimator/base.py +++ b/skore/src/skore/sklearn/_estimator/base.py @@ -2,7 +2,7 @@ from io import StringIO import joblib -from rich.console import Console +from rich.console import Console, Group from rich.panel import Panel from rich.tree import Tree @@ -42,10 +42,22 @@ def _get_method_description(self, method): else "No description available" ) + def _get_help_legend(self): + """Get the help legend.""" + return None + def _create_help_panel(self): """Create the help panel.""" + if self._get_help_legend(): + content = Group( + self._create_help_tree(), + f"\n\nLegend:\n{self._get_help_legend()}", + ) + else: + content = self._create_help_tree() + return Panel( - self._create_help_tree(), + content, title=self._get_help_panel_title(), expand=False, border_style="orange1", diff --git a/skore/src/skore/sklearn/_estimator/metrics_accessor.py b/skore/src/skore/sklearn/_estimator/metrics_accessor.py index 900070592..3531c2270 100644 --- a/skore/src/skore/sklearn/_estimator/metrics_accessor.py +++ b/skore/src/skore/sklearn/_estimator/metrics_accessor.py @@ -812,6 +812,11 @@ def _create_help_tree(self): def _get_help_panel_title(self): return f"[bold cyan]{self._icon} Available metrics methods[/bold cyan]" + def _get_help_legend(self): + return ( + "[cyan](↗︎)[/cyan] higher is better [orange1](↘︎)[/orange1] lower is better" + ) + def _get_help_tree_title(self): return "[bold cyan]reporter.metrics[/bold cyan]" diff --git a/skore/src/skore/sklearn/_estimator/report.py b/skore/src/skore/sklearn/_estimator/report.py index 996701479..a39b750bf 100644 --- a/skore/src/skore/sklearn/_estimator/report.py +++ b/skore/src/skore/sklearn/_estimator/report.py @@ -321,7 +321,12 @@ def _get_cached_response_values( def _get_help_panel_title(self): return ( f"[bold cyan]📓 Tools to diagnose estimator " - "{self.estimator_name}[/bold cyan]" + f"{self.estimator_name}[/bold cyan]" + ) + + def _get_help_legend(self): + return ( + "[cyan](↗︎)[/cyan] higher is better [orange1](↘︎)[/orange1] lower is better" ) def _create_help_tree(self):