diff --git a/dnotebooks/plots/plots.py b/dnotebooks/plots/plots.py index 69f6371..3c63802 100644 --- a/dnotebooks/plots/plots.py +++ b/dnotebooks/plots/plots.py @@ -762,7 +762,7 @@ def draw(self): seeds_confusion_matrices, self.epoch[0], self.epoch[1] )[:len(Y)] - self._ax.fill_between(X, Y_lower_bound, Y_upper_bound, color=c, alpha=.3) + self._ax.fill_between(X, Y_lower_bound, Y_upper_bound, color=c, alpha=.1) self._ax.plot(X, Y, color=c, label=label, alpha=1, **linestyle) if self.ylimit: diff --git a/dnotebooks/utils.py b/dnotebooks/utils.py index 68a8e56..01b2ce9 100644 --- a/dnotebooks/utils.py +++ b/dnotebooks/utils.py @@ -54,6 +54,8 @@ def get(self, key: str) -> str: @dataclass class LineStyle: DEFAULT = 'solid' + MARKERS = ['*', 'o', 's', 'D'] + LINESTYLES = ['solid', 'dashed', 'dotted'] STYLE_OPTIONS = [ 'solid', 'dashed', @@ -61,7 +63,15 @@ class LineStyle: '*', 'o', 's', - 'D' + 'D', + 'dashed-o', + 'dashed-s', + 'dashed-D', + 'dashed-*', + 'dotted-o', + 'dotted-s', + 'dotted-D', + 'dotted-*', ] linestyle: Optional[str] = None @@ -77,6 +87,13 @@ def to_kwargs(self): @staticmethod def resolve(label: Optional[str]) -> LineStyle: - if label in ['*', 'o', 's', 'D']: + if label is None: + return LineStyle(None, None) + if label in LineStyle.MARKERS: return LineStyle('solid', label) + if '-' in label: + linestyle, marker = label.split('-', 1) + if linestyle in LineStyle.LINESTYLES and marker in LineStyle.MARKERS: + return LineStyle(linestyle, marker) + raise ValueError(f"Unknown line style: {label!r}") return LineStyle(label, None) diff --git a/dnotebooks/widgets/selection.py b/dnotebooks/widgets/selection.py index 79f9ab2..a58a40a 100644 --- a/dnotebooks/widgets/selection.py +++ b/dnotebooks/widgets/selection.py @@ -35,7 +35,8 @@ def aggregate_mean(self) -> ExperimentMetric: if len(self.metrics) == 1: return ExperimentConfusionMatrix( devices_confusion_matrices=m0.data, - description=m0.description + description=m0.description, + time_devices_confusion_matrices=m0.time_data ) metrics_mean = [m.mean() for m in self.metrics] @@ -330,7 +331,7 @@ def ConfusionMatrixPartitionMultiSelection( experiments_groups: List[ExperimentGroup], description: str = "Select confusion matrix:" ): - def get_selection() -> Optional[Dict[str, ExperimentConfusionMatrix]]: + def get_confusion_matrix() -> Optional[Dict[str, ExperimentConfusionMatrix]]: if confusion_matrix_selection.value is None: return matrices = {} @@ -358,4 +359,4 @@ def get_selection() -> Optional[Dict[str, ExperimentConfusionMatrix]]: confusion_matrix_selection ], layout=layout) - return widget, get_selection + return widget, get_confusion_matrix