From dev-return-2403-archive-asf-public=cust-asf.ponee.io@singa.incubator.apache.org Thu Nov 29 07:23:04 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 27EAD18066C for ; Thu, 29 Nov 2018 07:23:03 +0100 (CET) Received: (qmail 52795 invoked by uid 500); 29 Nov 2018 06:23:03 -0000 Mailing-List: contact dev-help@singa.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@singa.incubator.apache.org Delivered-To: mailing list dev@singa.incubator.apache.org Received: (qmail 52785 invoked by uid 99); 29 Nov 2018 06:23:03 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Nov 2018 06:23:03 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id B8177180635 for ; Thu, 29 Nov 2018 06:23:02 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -110.301 X-Spam-Level: X-Spam-Status: No, score=-110.301 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id j7mdKck65fNM for ; Thu, 29 Nov 2018 06:23:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 078AD5F67C for ; Thu, 29 Nov 2018 06:23:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 4F825E00B4 for ; Thu, 29 Nov 2018 06:23:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0B79421096 for ; Thu, 29 Nov 2018 06:23:00 +0000 (UTC) Date: Thu, 29 Nov 2018 06:23:00 +0000 (UTC) From: "wangwei (JIRA)" To: dev@singa.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (SINGA-412) Log visualization API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 wangwei created SINGA-412: ----------------------------- Summary: Log visualization API Key: SINGA-412 URL: https://issues.apache.org/jira/browse/SINGA-412 Project: Singa Issue Type: Improvement Reporter: wangwei 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)