Multiple lines can be added to the same plot with the "name" attribute (see example) Args: fields: Currently unused plot_type: {scatter, line} Examples: >>> scatter_logger = VisdomPlotLogger('line')
(self, plot_type, fields=None, win=None, env=None, opts={}, port=8097, server="localhost", name=None)
| 1001 | class VisdomPlotLogger(BaseVisdomLogger): |
| 1002 | |
| 1003 | def __init__(self, plot_type, fields=None, win=None, env=None, opts={}, port=8097, server="localhost", name=None): |
| 1004 | ''' |
| 1005 | Multiple lines can be added to the same plot with the "name" attribute (see example) |
| 1006 | Args: |
| 1007 | fields: Currently unused |
| 1008 | plot_type: {scatter, line} |
| 1009 | |
| 1010 | Examples: |
| 1011 | >>> scatter_logger = VisdomPlotLogger('line') |
| 1012 | >>> scatter_logger.log(stats['epoch'], loss_meter.value()[0], name="train") |
| 1013 | >>> scatter_logger.log(stats['epoch'], loss_meter.value()[0], name="test") |
| 1014 | ''' |
| 1015 | super(VisdomPlotLogger, self).__init__(fields, win, env, opts, port, server) |
| 1016 | valid_plot_types = { |
| 1017 | "scatter": self.viz.scatter, |
| 1018 | "line": self.viz.line} |
| 1019 | self.plot_type = plot_type |
| 1020 | # Set chart type |
| 1021 | if plot_type not in valid_plot_types.keys(): |
| 1022 | raise ValueError("plot_type \'{}\' not found. Must be one of {}".format( |
| 1023 | plot_type, valid_plot_types.keys())) |
| 1024 | self.chart = valid_plot_types[plot_type] |
| 1025 | |
| 1026 | def log(self, *args, **kwargs): |
| 1027 | if self.win is not None and self.viz.win_exists(win=self.win, env=self.env): |