INNER CODE UNIT · Python
y_bounds
timeseriesAI/tsai · tsai/callback/core.py:96
y_bounds = (y_min - margin, y_max + margin)
self.update_graph([(iters, rec.losses), (self.nb_batches, val_losses)], x_bounds, y_bounds)
def after_fit(self):
if hasattr(self, 'graph_ax'):
plt.close(self.graph_ax.figure)
if self.plot_metrics:
self.learn.plot_metrics(final_losses=self.final_losses, perc=self.perc)
def update_graph(self, graphs, x_bounds=None, y_bounds=None, figsize=(6,4)):
if not hasattr(self, 'graph_fig'):
self.graph_fig, self.graph_ax = plt.subplots(1, figsize=figsize)
self.graph_out = display(self.graph_ax.figure, display_id=True)
self.graph_ax.clear()
if len(self.names) < len(graphs): self.names += [''] * (len(graphs) - len(self.names))
for g,n in zip(graphs,self.names):
if (g[1] == [None] * len(g[1])): continue
self.graph_ax.plot(*g, label=n)