mirror of
https://github.com/clearml/clearml
synced 2025-03-12 06:41:17 +00:00
Add logger.report_confusion_matrix arg yaxis_reversed (when True flip the confusion matrix, default False). Issue #165
This commit is contained in:
parent
a3c191742b
commit
79799d3efd
@ -55,6 +55,17 @@ def report_plots(logger, iteration=0):
|
||||
yaxis="title Y",
|
||||
)
|
||||
|
||||
# report confusion matrix with 0,0 is at the top left
|
||||
logger.report_matrix(
|
||||
"example_confusion_0_0_at_top",
|
||||
"ignored",
|
||||
iteration=iteration,
|
||||
matrix=confusion,
|
||||
xaxis="title X",
|
||||
yaxis="title Y",
|
||||
yaxis_reversed=True,
|
||||
)
|
||||
|
||||
scatter2d = np.hstack(
|
||||
(np.atleast_2d(np.arange(0, 10)).T, np.random.randint(10, size=(10, 1)))
|
||||
)
|
||||
|
@ -523,7 +523,7 @@ class Reporter(InterfaceBase, AbstractContextManager, SetupUploadMixin, AsyncMan
|
||||
)
|
||||
|
||||
def report_value_matrix(self, title, series, data, iter, xtitle=None, ytitle=None, xlabels=None, ylabels=None,
|
||||
comment=None, layout_config=None):
|
||||
yaxis_reversed=False, comment=None, layout_config=None):
|
||||
"""
|
||||
Report a heat-map matrix
|
||||
|
||||
@ -539,6 +539,7 @@ class Reporter(InterfaceBase, AbstractContextManager, SetupUploadMixin, AsyncMan
|
||||
:param str ytitle: optional y-axis title
|
||||
:param xlabels: optional label per column of the matrix
|
||||
:param ylabels: optional label per row of the matrix
|
||||
:param bool yaxis_reversed: If False 0,0 is at the bottom left corner. If True 0,0 is at the Top left corner
|
||||
:param comment: comment underneath the title
|
||||
:param layout_config: optional dictionary for layout configuration, passed directly to plotly
|
||||
:type layout_config: dict or None
|
||||
@ -553,6 +554,7 @@ class Reporter(InterfaceBase, AbstractContextManager, SetupUploadMixin, AsyncMan
|
||||
comment=comment,
|
||||
xtitle=xtitle,
|
||||
ytitle=ytitle,
|
||||
yaxis_reversed=yaxis_reversed,
|
||||
layout_config=layout_config,
|
||||
)
|
||||
|
||||
|
@ -572,6 +572,7 @@ class Logger(object):
|
||||
yaxis=None, # type: Optional[str]
|
||||
xlabels=None, # type: Optional[List[str]]
|
||||
ylabels=None, # type: Optional[List[str]]
|
||||
yaxis_reversed=False, # type: bool
|
||||
comment=None, # type: Optional[str]
|
||||
extra_layout=None, # type: Optional[dict]
|
||||
):
|
||||
@ -594,6 +595,7 @@ class Logger(object):
|
||||
:param str yaxis: The y-axis title. (Optional)
|
||||
:param list(str) xlabels: Labels for each column of the matrix. (Optional)
|
||||
:param list(str) ylabels: Labels for each row of the matrix. (Optional)
|
||||
:param bool yaxis_reversed: If False 0,0 is at the bottom left corner. If True 0,0 is at the Top left corner
|
||||
:param str comment: A comment displayed with the plot, underneath the title.
|
||||
:param dict extra_layout: optional dictionary for layout configuration, passed directly to plotly
|
||||
example: extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
|
||||
@ -614,6 +616,7 @@ class Logger(object):
|
||||
ytitle=yaxis,
|
||||
xlabels=xlabels,
|
||||
ylabels=ylabels,
|
||||
yaxis_reversed=yaxis_reversed,
|
||||
comment=comment,
|
||||
layout_config=extra_layout,
|
||||
)
|
||||
@ -628,6 +631,7 @@ class Logger(object):
|
||||
yaxis=None, # type: Optional[str]
|
||||
xlabels=None, # type: Optional[List[str]]
|
||||
ylabels=None, # type: Optional[List[str]]
|
||||
yaxis_reversed=False, # type: bool
|
||||
extra_layout=None, # type: Optional[dict]
|
||||
):
|
||||
"""
|
||||
@ -644,12 +648,14 @@ class Logger(object):
|
||||
:param str yaxis: The y-axis title. (Optional)
|
||||
:param list(str) xlabels: Labels for each column of the matrix. (Optional)
|
||||
:param list(str) ylabels: Labels for each row of the matrix. (Optional)
|
||||
:param bool yaxis_reversed: If False 0,0 is at the bottom left corner. If True 0,0 is at the Top left corner
|
||||
:param dict extra_layout: optional dictionary for layout configuration, passed directly to plotly
|
||||
example: extra_layout={'xaxis': {'type': 'date', 'range': ['2020-01-01', '2020-01-31']}}
|
||||
"""
|
||||
self._touch_title_series(title, series)
|
||||
return self.report_confusion_matrix(title, series, matrix, iteration,
|
||||
xaxis=xaxis, yaxis=yaxis, xlabels=xlabels, ylabels=ylabels,
|
||||
yaxis_reversed=yaxis_reversed,
|
||||
extra_layout=extra_layout)
|
||||
|
||||
def report_surface(
|
||||
|
@ -217,7 +217,7 @@ def create_3d_scatter_series(np_row_wise, title="Scatter", series_name="Series",
|
||||
|
||||
|
||||
def create_value_matrix(np_value_matrix, title="Heatmap Matrix", xlabels=None, ylabels=None, xtitle="X", ytitle="Y",
|
||||
custom_colors=True, series=None, comment=None, layout_config=None):
|
||||
custom_colors=True, series=None, comment=None, yaxis_reversed=False, layout_config=None):
|
||||
conf_matrix_plot = {
|
||||
"data": [
|
||||
{
|
||||
@ -240,6 +240,8 @@ def create_value_matrix(np_value_matrix, title="Heatmap Matrix", xlabels=None, y
|
||||
"name": series,
|
||||
}
|
||||
}
|
||||
if yaxis_reversed:
|
||||
conf_matrix_plot['layout']['yaxis']['autorange'] = "reversed"
|
||||
|
||||
if custom_colors:
|
||||
scale, bar = _get_z_colorbar_data()
|
||||
|
Loading…
Reference in New Issue
Block a user