You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@singa.apache.org by "Ngin Yun Chuan (JIRA)" <ji...@apache.org> on 2018/12/07 04:41:00 UTC
[jira] [Commented] (SINGA-412) Log visualization API
[ https://issues.apache.org/jira/browse/SINGA-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16712331#comment-16712331 ]
Ngin Yun Chuan commented on SINGA-412:
--------------------------------------
Hi [~wangwei.cs], would like feedback on changes at https://github.com/nginyc/rafiki/compare/improve_knob_api...improve_model_logging. Includes shortening/renaming of the API methods, and a rework of the implementation of logging that streams logs into the DB, allowing app developers to view plots & message logs while the train job is running.
> Log visualization API
> ---------------------
>
> Key: SINGA-412
> URL: https://issues.apache.org/jira/browse/SINGA-412
> Project: Singa
> Issue Type: Improvement
> Reporter: wangwei
> Priority: Major
>
> The current visualization API in the Rafiki model.py 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
(v7.6.3#76005)