singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wangwei (JIRA)" <>
Subject [jira] [Created] (SINGA-412) Log visualization API
Date Thu, 29 Nov 2018 06:23:00 GMT
wangwei created SINGA-412:

             Summary: Log visualization API
                 Key: SINGA-412
             Project: Singa
          Issue Type: Improvement
            Reporter: wangwei

The current visualization API in the Rafiki can be simplified.
class Logger:
  ''' For logging data to web front-end.
  It supports logging text messages via log(prefix), and logging key-value pairs log(**kwargs),
e.g., log(loss=0.1, accuracy=0.4, epoch=1, step=34); To visualize the data on the web page,
the plot has to be defined before logging the data via define_plot(). 

  TODO log (numpy) array.

      log = Logger()
      log.log('start training')
      log.define_plot('train loss and accuracy', yaxes=['loss', 'acc'], xaxis='epoch')
      for epoch in range(10):
           log.log(loss=0.1, acc=0.4, epoch=epoch)
           # or 
           # log.log(loss=0.1, epoch=epoch)
           # log.log(acc=0.4, epoch=epoch)
  def define_plot(name, yaxes = ['loss'], xaxis='epoch')
  ''' define the plot to be visualized in the web page.

       name: string for plot name.
       yaxes: a list of string for the names of the items/metrics, e.g., loss, accuracy, learning
rate, etc. One name corresponds to one key in log().
       xaxis: string for the xaxis, e.g., epoch or step to indicate the progress. It also
corresponds to on key in log(). 
  def log(prefix='', **kwargs)
  ''' log one piece of msg and key-val pairs.
        prefix: text string.
        kwargs: key-value pairs. key is a string and value is a number. To visualize one key-value,
the plot must be defined via define_plot, and the key must be included in the yaxes, and another
key must be the xaxis. For example, the loss and acc in log(loss=0.1, acc=0.4, epoch=1, step=34)
can be visualized in the plot generated by define_plot('loss and acc', yaxes=['loss', 'acc'],

For each log entry, we must also keep the time. In the front end, we can plot either the yaxes-xaxis
or yaxes-time.

This message was sent by Atlassian JIRA

View raw message