Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def draw(self):
if self.target == MATPLOTLIB_TARGET:
draw_plot(self.logs, self.base_metrics,
figsize=self.figsize,
max_epoch=self.max_epoch,
max_cols=self.max_cols,
series_fmt=self.series_fmt,
metric2title=self.metric2title,
skip_first=self.skip_first,
extra_plots=self.extra_plots,
fig_path=self.fig_path)
if self.metrics_extrema:
print_extrema(self.logs,
self.base_metrics,
self.metrics_extrema,
series_fmt=self.series_fmt,
metric2title=self.metric2title)
if self.target == NEPTUNE_TARGET:
def _validate_target(self):
assert isinstance(self.target, str),\
'target must be str, got "{}" instead.'.format(type(self.target))
if self.target != MATPLOTLIB_TARGET and self.target != NEPTUNE_TARGET:
raise ValueError('Target must be "{}" or "{}", got "{}" instead.'.format(MATPLOTLIB_TARGET, NEPTUNE_TARGET, self.target))
def __init__(self,
figsize=None,
cell_size=(6, 4),
dynamic_x_axis=False,
max_cols=2,
max_epoch=None,
metric2title={},
series_fmt={'training': '{}', 'validation':'val_{}'},
validation_fmt="val_{}",
plot_extrema=True,
skip_first=2,
extra_plots=[],
fig_path=None,
tensorboard_dir=None,
target=MATPLOTLIB_TARGET):
self.figsize = figsize
self.cell_size = cell_size
self.dynamic_x_axis = dynamic_x_axis
self.max_cols = max_cols
self.max_epoch = max_epoch
self.metric2title = metric2title
self.series_fmt = series_fmt
if validation_fmt is not None:
# backward compatibility
self.series_fmt['validation'] = validation_fmt
self.logs = None
self.base_metrics = None
self.metrics_extrema = None
self.plot_extrema = plot_extrema
self.skip_first = skip_first
self.target = target