singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ngin Yun Chuan (JIRA)" <>
Subject [jira] [Commented] (SINGA-412) Log visualization API
Date Tue, 11 Dec 2018 02:16:00 GMT


Ngin Yun Chuan commented on SINGA-412:

Hi @wangwei, 

I'll be combining the changes to the model logging & model knobs APIs with the upcoming
changes for preferential worker node placement.

In the current implementation, there is a single global logger instance for each worker, shared
across all trials conducted in the worker. In the file,
line 152, the logger's handler is replaced every trial.

> Log visualization API
> ---------------------
>                 Key: SINGA-412
>                 URL:
>             Project: Singa
>          Issue Type: Improvement
>            Reporter: wangwei
>            Priority: Major
> The current visualization API in the Rafiki can be simplified.
> {code:java}
> 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.
>   Example:
>       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.
>   Args:
>        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.
>   Args:
>         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'], xaxis='epoch')
>   '''
> {code}
> 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