未验证 提交 5937df7f 编写于 作者: 走神的阿圆's avatar 走神的阿圆 提交者: GitHub

Update docs for hp.

上级 89fadd59
...@@ -293,6 +293,14 @@ Developers can compare multiple experiments by specifying and uploading the path ...@@ -293,6 +293,14 @@ Developers can compare multiple experiments by specifying and uploading the path
</p> </p>
### Text
**Text** visualizes the text output of NLP models within any stage, aiding developers to compare the changes of outputs so as to deeply understand the training process and simply evaluate the performance of the model.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/106248340-cdd09400-624b-11eb-8ea9-5a07a239c365.png" width="85%"/>
</p>
### Graph ### Graph
**Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows developers to explore model attributes, node information, node input and output. aiding them analyze model structures quickly and understand the direction of data flow easily. **Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows developers to explore model attributes, node information, node input and output. aiding them analyze model structures quickly and understand the direction of data flow easily.
...@@ -346,6 +354,15 @@ Developers can compare multiple experiments by specifying and uploading the path ...@@ -346,6 +354,15 @@ Developers can compare multiple experiments by specifying and uploading the path
</p> </p>
### Hyper Parameters
**Hyper Parameters** visualize the relationship between hyperparameters and model metrics (such as accuracy and loss) in a rich view, helping you identify the best hyperparameters in an efficient way.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119247155-e9c0c280-bbb9-11eb-8175-58a9c7657a9c.gif" width="85%"/>
</p>
### VDL.service ### VDL.service
**VDL.service** enables developers to easily save, track and share visualization results with anyone for free. **VDL.service** enables developers to easily save, track and share visualization results with anyone for free.
......
...@@ -304,6 +304,14 @@ value: 3.1297709941864014 ...@@ -304,6 +304,14 @@ value: 3.1297709941864014
</p> </p>
### Text
展示文本任务任意阶段的数据输出,对比不同阶段的文本变化,便于深入了解训练过程及效果。
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/106248340-cdd09400-624b-11eb-8ea9-5a07a239c365.png" width="85%"/>
</p>
### Graph ### Graph
一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向。 一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向。
...@@ -356,6 +364,15 @@ value: 3.1297709941864014 ...@@ -356,6 +364,15 @@ value: 3.1297709941864014
</p> </p>
### Hyper Parameters
以丰富的视图多角度地可视化超参数与模型关键指标间的关系,便于快速确定最佳超参组合,实现高效调参。
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119247155-e9c0c280-bbb9-11eb-8175-58a9c7657a9c.gif" width="85%"/>
</p>
### VDL.service ### VDL.service
VisualDL可视化结果保存服务,以链接形式将可视化结果保存下来,方便用户快速、便捷的进行托管与分享。 VisualDL可视化结果保存服务,以链接形式将可视化结果保存下来,方便用户快速、便捷的进行托管与分享。
......
# Copyright (c) 2021 VisualDL Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =======================================================================
# coding=utf-8
from visualdl import LogWriter
if __name__ == '__main__':
# 记录第一次实验数据
with LogWriter('./log/hparams_test/train/run1') as writer:
# 记录hparams数值和metrics名称
writer.add_hparams(hparam_dict={'lr': 0.1, 'bsize': 1, 'opt': 'sgd'},
metric_list=['hparam/accuracy', 'hparam/loss'])
# 通过将add_scalar接口中的tag与metrics名称对应,记录一次实验中不同step的metrics数值
for i in range(10):
writer.add_scalar(tag='hparam/accuracy', value=i, step=i)
writer.add_scalar(tag='hparam/loss', value=2*i, step=i)
# 记录第二次实验数据
with LogWriter('./log/hparams_test/train/run2') as writer:
# 记录hparams数值和metrics名称
writer.add_hparams(hparam_dict={'lr': 0.2, 'bsize': 2, 'opt': 'relu'},
metric_list=['hparam/accuracy', 'hparam/loss'])
# 通过将add_scalar接口中的tag与metrics名称对应,记录一次实验中不同step的metrics数值
for i in range(10):
writer.add_scalar(tag='hparam/accuracy', value=1.0/(i+1), step=i)
writer.add_scalar(tag='hparam/loss', value=5*i, step=i)
...@@ -230,6 +230,13 @@ Developers can compare with multiple experiments by specifying and uploading the ...@@ -230,6 +230,13 @@ Developers can compare with multiple experiments by specifying and uploading the
<img src="https://user-images.githubusercontent.com/48054808/90869771-47c23e80-e3cb-11ea-8b2a-a38b6c33d64b.png" width="85%"/> <img src="https://user-images.githubusercontent.com/48054808/90869771-47c23e80-e3cb-11ea-8b2a-a38b6c33d64b.png" width="85%"/>
</p> </p>
### Text
**Text** visualizes the text output of NLP models within any stage, aiding developers to compare the changes of outputs so as to deeply understand the training process and simply evaluate the performance of the model.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/106248340-cdd09400-624b-11eb-8ea9-5a07a239c365.png" width="85%"/>
</p>
### Graph ### Graph
**Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows Developers to explore model attributes, node information, node input and output. aiding them analyze model structure quickly and understand the direction of data flow easily. **Graph** enables developers to visualize model structures by only one click. Moreover, **Graph** allows Developers to explore model attributes, node information, node input and output. aiding them analyze model structure quickly and understand the direction of data flow easily.
...@@ -260,7 +267,15 @@ Developers can compare with multiple experiments by specifying and uploading the ...@@ -260,7 +267,15 @@ Developers can compare with multiple experiments by specifying and uploading the
**High Dimensional** provides two approaches--T-SNE and PCA--to do the dimensionality reduction, allowing developers to have an in-depth analysis of the relationship between high-dimensional data and to optimize algorithms based on the analysis. **High Dimensional** provides two approaches--T-SNE and PCA--to do the dimensionality reduction, allowing developers to have an in-depth analysis of the relationship between high-dimensional data and to optimize algorithms based on the analysis.
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/48054808/90870677-85739700-e3cc-11ea-8653-18fa5c4106a3.GIF" width="85%"/> <img src="https://user-images.githubusercontent.com/48054808/103188111-1b32ac00-4902-11eb-914e-c2368bdb8373.gif" width="85%"/>
</p>
### Hyper Parameters
**Hyper Parameters** visualize the relationship between hyperparameters and model metrics (such as accuracy and loss) in a rich view, helping you identify the best hyperparameters in an efficient way.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119247155-e9c0c280-bbb9-11eb-8175-58a9c7657a9c.gif" width="85%"/>
</p> </p>
### VDL.service ### VDL.service
......
...@@ -241,6 +241,13 @@ app.run(logdir="./log") ...@@ -241,6 +241,13 @@ app.run(logdir="./log")
<img src="https://user-images.githubusercontent.com/48054808/87659138-b4746880-c78f-11ea-965b-c33804e7c296.png" width="85%"/> <img src="https://user-images.githubusercontent.com/48054808/87659138-b4746880-c78f-11ea-965b-c33804e7c296.png" width="85%"/>
</p> </p>
### Text
展示文本任务任意阶段的数据输出,对比不同阶段的文本变化,便于深入了解训练过程及效果。
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/106248340-cdd09400-624b-11eb-8ea9-5a07a239c365.png" width="85%"/>
</p>
### Graph ### Graph
一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向。 一键可视化模型的网络结构。可查看模型属性、节点信息、节点输入输出等,并支持节点搜索,辅助用户快速分析模型结构与了解数据流向。
...@@ -280,6 +287,14 @@ app.run(logdir="./log") ...@@ -280,6 +287,14 @@ app.run(logdir="./log")
<img src="https://user-images.githubusercontent.com/48054808/82396340-3e4dd100-9a80-11ea-911d-798acdbc9c90.gif" width="85%"/> <img src="https://user-images.githubusercontent.com/48054808/82396340-3e4dd100-9a80-11ea-911d-798acdbc9c90.gif" width="85%"/>
</p> </p>
### Hyper Parameters
以丰富的视图多角度地可视化超参数与模型关键指标间的关系,便于快速确定最佳超参组合,实现高效调参。
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119247155-e9c0c280-bbb9-11eb-8175-58a9c7657a9c.gif" width="85%"/>
</p>
### VDL.service ### VDL.service
VisualDL可视化结果保存服务,以链接形式将可视化结果保存下来,方便用户快速、便捷的进行托管与分享。 VisualDL可视化结果保存服务,以链接形式将可视化结果保存下来,方便用户快速、便捷的进行托管与分享。
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
VisualDL is a visualization tool designed for Deep Learning. VisualDL provides a variety of charts to show the trends of parameters. It enables users to understand the training process and model structures of Deep Learning models more clearly and intuitively so as to optimize models efficiently. VisualDL is a visualization tool designed for Deep Learning. VisualDL provides a variety of charts to show the trends of parameters. It enables users to understand the training process and model structures of Deep Learning models more clearly and intuitively so as to optimize models efficiently.
Currently, VisualDL provides seven components: scalar, image, audio, graph, histogram, pr curve, ROC curve and high dimensional. VisualDL iterates rapidly and new functions will be continuously added. Currently, VisualDL provides ten components: scalar, image, audio, text, graph, histogram, pr curve, ROC curve, high dimensional and hyper parameters. VisualDL iterates rapidly and new functions will be continuously added.
...@@ -16,12 +16,13 @@ Currently, VisualDL provides seven components: scalar, image, audio, graph, hist ...@@ -16,12 +16,13 @@ Currently, VisualDL provides seven components: scalar, image, audio, graph, hist
| [ Scalar](#Scalar--Line-Chart) | Line Chart | Display scalar data such as loss and accuracy dynamically. | | [ Scalar](#Scalar--Line-Chart) | Line Chart | Display scalar data such as loss and accuracy dynamically. |
| [Image](#Image--Image-Visualization) | Image Visualization | Display images, visualizing the input and the output and making it easy to view the changes in the intermediate process. | | [Image](#Image--Image-Visualization) | Image Visualization | Display images, visualizing the input and the output and making it easy to view the changes in the intermediate process. |
| [Audio](#Audio--Audio-Play) | Audio Play | Play the audio during the training process, making it easy to monitor the process of speech recognition and text-to-speech. | | [Audio](#Audio--Audio-Play) | Audio Play | Play the audio during the training process, making it easy to monitor the process of speech recognition and text-to-speech. |
| [Text](#Text) | Text Visualization | Visualizes the text output of NLP models within any stage, aiding developers to compare the changes of outputs so as to deeply understand the training process and simply evaluate the performance of the model. | | [Text](#Text) | Text Visualization | Visualize the text output of NLP models within any stage, aiding developers to compare the changes of outputs so as to deeply understand the training process and simply evaluate the performance of the model. |
| [Graph](#Graph--Network-Structure) | Network Structure | Visualize network structures, node attributes and data flow, assisting developers to learn and to optimize network structures. | | [Graph](#Graph--Network-Structure) | Network Structure | Visualize network structures, node attributes and data flow, assisting developers to learn and to optimize network structures. |
| [Histogram](#Histogram--Distribution-of-Tensors) | Distribution of Tensors | Present the changes of distributions of tensors, such as weights/gradients/bias, during the training process. | | [Histogram](#Histogram--Distribution-of-Tensors) | Distribution of Tensors | Present the changes of distributions of tensors, such as weights/gradients/bias, during the training process. |
| [PR Curve](#PR-Curve) | Precision & Recall Curve | Display precision-recall curves across training steps, clarifying the tradeoff between precision and recall when comparing models. | | [PR Curve](#PR-Curve) | Precision & Recall Curve | Display precision-recall curves across training steps, clarifying the tradeoff between precision and recall when comparing models. |
| [ROC Curve](#ROC-Curve) | Receiver Operating Characteristic curve | Shows the performance of a classification model at all classification thresholds. | | [ROC Curve](#ROC-Curve) | Receiver Operating Characteristic curve | Show the performance of a classification model at all classification thresholds. |
| [High Dimensional](#High-Dimensional--Data-Dimensionality-Reduction) | Data Dimensionality Reduction | Project high-dimensional data into 2D/3D space for embedding visualization, making it convenient to observe the correlation between data. | | [High Dimensional](#High-Dimensional--Data-Dimensionality-Reduction) | Data Dimensionality Reduction | Project high-dimensional data into 2D/3D space for embedding visualization, making it convenient to observe the correlation between data. |
| [Hyper Parameters](#hyperparameters--hyperparameter-visualization) | HyperParameter Visualization | Visualize the relationship between hyperparameters and model metrics (such as accuracy and loss) in a rich view, helping you identify the best hyperparameters in an efficient way. |
At the same time, VisualDL provides [VDL.service](#vdlservice) , which allows developers to easily save, track and share visualization results of experiments with anyone for free. At the same time, VisualDL provides [VDL.service](#vdlservice) , which allows developers to easily save, track and share visualization results of experiments with anyone for free.
...@@ -880,6 +881,121 @@ Then, open the browser and enter the address`http://127.0.0.1:8080` to view: ...@@ -880,6 +881,121 @@ Then, open the browser and enter the address`http://127.0.0.1:8080` to view:
<img src="https://user-images.githubusercontent.com/48054808/103192766-d2d0b980-4914-11eb-871e-e4b31542c5e9.png" width="27%"/> <img src="https://user-images.githubusercontent.com/48054808/103192766-d2d0b980-4914-11eb-871e-e4b31542c5e9.png" width="27%"/>
</p> </p>
## HyperParameters--HyperParameter Visualization
### Introduction
HyperParameters visualize the relationship between hyperparameters and model metrics (such as accuracy and loss) in a rich view, helping you identify the best hyperparameters in an efficient way.
### Record Interface
The interface of the HyperParameters is slightly different from other components'. Firstly, you need to use the `add_hparams` to record the hyperparameter data(`hparams_dict`) and specify the name of the metrics(`metrics_list`). Then, for the metrics you just added, you need to record those metrics values by using `add_scalar`. In this way you can get all data for HpyerParameters Visualization.
```python
add_hparams(hparam_dict, metric_list, walltime=None):
```
The interface parameters are described as follows:
| parameter | format | meaning |
| ----------- | ------------------- | ---------------------------------- |
| hparam_dict | dict | name and data of hparams. |
| metric_list | list | The metrics name to be recorded later corresponds to the `tag` parameter in the `add_scalar` interface, and VisualDL corresponds to the indicator data through the `tag`. |
| walltime | int | Record the time stamp of the data, the default is the current time stamp. |
### Demo
The following shows an example of how to use HyperParameters component, and script can be found in [HyperParameters Demo](https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/components/hparams_test.py)
```python
from visualdl import LogWriter
# This demo demonstrates the hyperparameter records of two experiments. Take the first
# experiment data as an example, First, record the data of the hyperparameter `hparams`
# in the `add_hparams` interface. Then specify the name of `metrics` to be recorded later.
# Finally, use `add_scalar` to specifically record the data of `metrics`. Note that the
# `metrics_list` parameter in the `add_hparams` interface needs to include the `tag`
# parameter of the `add_scalar` interface.
if __name__ == '__main__':
# Record the data of the first experiment
with LogWriter('./log/hparams_test/train/run1') as writer:
# Record the value of `hparams` and the name of `metrics`
writer.add_hparams(hparams_dict={'lr': 0.1, 'bsize': 1, 'opt': 'sgd'},
metrics_list=['hparam/accuracy', 'hparam/loss'])
# Record the metrics values ​​of different steps in an experiment by matching
# the `tag` in the `add_scalar` interface with `metrics_list` in `add_hparams` interface.
for i in range(10):
writer.add_scalar(tag='hparam/accuracy', value=i, step=i)
writer.add_scalar(tag='hparam/loss', value=2*i, step=i)
# Record the data of the second experiment
with LogWriter('./log/hparams_test/train/run2') as writer:
# Record the value of `hparams` and the name of `metrics`
writer.add_hparams(hparams_dict={'lr': 0.2, 'bsize': 2, 'opt': 'relu'},
metrics_list=['hparam/accuracy', 'hparam/loss'])
# Record the metrics values ​​of different steps in an experiment by matching
# the `tag` in the `add_scalar` interface with `metrics_list` in `add_hparams` interface.
for i in range(10):
writer.add_scalar(tag='hparam/accuracy', value=1.0/(i+1), step=i)
writer.add_scalar(tag='hparam/loss', value=5*i, step=i)
```
After running the above program, developers can launch the panel by:
```shell
visualdl --logdir ./log --port 8080
```
Then, open the browser and enter the address`http://127.0.0.1:8080` to view:
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119247155-e9c0c280-bbb9-11eb-8175-58a9c7657a9c.gif" width="85%"/>
</p>
### Functional Instrucions
* Table View
- The table view can be displayed in a sorted order.
- Trial ID represents a specific experiment name, the column name displayed in other normal fonts is the hyperparameter name, and the column displayed in bold font is the metric name.
- The position of hyperparameters and metrics can be customized by dragging.
- The column width of the table view can be adjusted by dragging.
- You can click to expand to view the scalar of the metrics.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119219705-75364700-bb19-11eb-9077-064337ae95be.png" width="85%"/>
</p>
* Parallel Coordinates View
- The specific values ​​of hyperparameters and metrics in a certain set of experiments can be displayed by hovering.
- Scalar of the metrics in this group of experiments can be displayed by selecting a certain curve.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119221098-440d4500-bb20-11eb-8b26-d29f95147c04.png" width="85%"/>
</p>
* Scatter Plot Matrix View
- The specific values ​​of hyperparameters and metrics in a certain set of experiments can be displayed by hovering.
- Scalar of the metrics in this group of experiments can be displayed by selecting a certain point.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119221108-54252480-bb20-11eb-9a8f-1d082c36402b.png" width="85%"/>
</p>
* Scalar of Metrics
- Can be viewed in table view, parallel coordinates view and scatter plot matrix view.
- Scalar of the metrics viewed here can also be viewed under the `SCALARS` board.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119221127-6901b800-bb20-11eb-84f0-407bd7241bc7.png" width="85%"/>
</p>
* Hyperparameter/metric range selection
- Display part of the data by selecting the range of hyperparameters or metrics.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119221141-78810100-bb20-11eb-9e06-5b345459310a.png" width="20%"/>
</p>
* download data
- Two formats can be selected, CSV or TSV.
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119221157-8b93d100-bb20-11eb-9c9e-7540b3cb92a1.png" width="20%"/>
</p>
## VDL.service ## VDL.service
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
VisualDL 是一个面向深度学习任务设计的可视化工具。VisualDL 利用了丰富的图表来展示数据,用户可以更直观、清晰地查看数据的特征与变化趋势,有助于分析数据、及时发现错误,进而改进神经网络模型的设计。 VisualDL 是一个面向深度学习任务设计的可视化工具。VisualDL 利用了丰富的图表来展示数据,用户可以更直观、清晰地查看数据的特征与变化趋势,有助于分析数据、及时发现错误,进而改进神经网络模型的设计。
目前,VisualDL 支持 scalar, image, audio,graph, histogram, pr curve, ROC curve, high dimensional 七个组件,项目正处于高速迭代中,敬请期待新组件的加入。 目前,VisualDL 支持 scalar, image, audio,text, graph, histogram, pr curve, ROC curve, high dimensional, hyper parameters 十个组件,项目正处于高速迭代中,敬请期待新组件的加入。
| 组件名称 | 展示图表 | 作用 | | 组件名称 | 展示图表 | 作用 |
| :----------------------------------------------------------: | :--------: | :----------------------------------------------------------- | | :----------------------------------------------------------: | :--------: | :----------------------------------------------------------- |
...@@ -19,6 +19,7 @@ VisualDL 是一个面向深度学习任务设计的可视化工具。VisualDL ...@@ -19,6 +19,7 @@ VisualDL 是一个面向深度学习任务设计的可视化工具。VisualDL
| [PR Curve](#PR-Curve--PR曲线组件) | 折线图 | 权衡精度与召回率之间的平衡关系 | | [PR Curve](#PR-Curve--PR曲线组件) | 折线图 | 权衡精度与召回率之间的平衡关系 |
| [ROC Curve](#ROC-Curve--ROC曲线组件) | 折线图 | 展示不同阈值下的模型表现 | | [ROC Curve](#ROC-Curve--ROC曲线组件) | 折线图 | 展示不同阈值下的模型表现 |
| [High Dimensional](#High-Dimensional--数据降维组件) | 数据降维 | 将高维数据映射到 2D/3D 空间来可视化嵌入,便于观察不同数据的相关性 | | [High Dimensional](#High-Dimensional--数据降维组件) | 数据降维 | 将高维数据映射到 2D/3D 空间来可视化嵌入,便于观察不同数据的相关性 |
| [Hyper Parameters](#HyperParameters--超参可视化组件) | 超参数可视化 | 以丰富的视图多角度地可视化超参数与模型关键指标间的关系,便于快速确定最佳超参组合,实现高效调参。 |
同时,VisualDL提供可视化结果保存服务,通过 [VDL.service](#vdlservice) 生成链接,保存并分享可视化结果 同时,VisualDL提供可视化结果保存服务,通过 [VDL.service](#vdlservice) 生成链接,保存并分享可视化结果
...@@ -927,32 +928,119 @@ visualdl --logdir ./log --port 8080 ...@@ -927,32 +928,119 @@ visualdl --logdir ./log --port 8080
<img src="https://user-images.githubusercontent.com/48054808/103188111-1b32ac00-4902-11eb-914e-c2368bdb8373.gif" width="85%"/> <img src="https://user-images.githubusercontent.com/48054808/103188111-1b32ac00-4902-11eb-914e-c2368bdb8373.gif" width="85%"/>
</p> </p>
## HyperParameters--超参可视化组件
### 介绍
HyperParameters 以丰富的视图多角度地可视化超参数与模型关键指标间的关系,便于快速确定最佳超参组合,实现高效调参。
### 记录接口
HyperParameters 组件的记录接口与其他组件稍有不同,需要先通过`add_hparams`接口记录超参数(`hparams_dict`)和所需展示的模型度量指标名称(`metrics_list`)如loss、acc等,再通过调用`add_scalar`记录具体的模型度量指标的数值,即可记录完整的超参数可视化数据,接口说明如下:
```python
add_hparams(hparam_dict, metric_list, walltime=None):
```
接口参数说明如下:
| 参数 | 格式 | 含义 |
| ----------- | ------------------- | ---------------------------------------------------- |
| hparam_dict | dict | 超参数名称及数据 |
| metric_list | list | 稍后要记录的指标名称,对应`add_scalar`接口中的`tag`参数,VisualDL通过`tag`对应指标数据。 |
| walltime | int | 记录数据的时间戳,默认为当前时间戳 |
### Demo
下面展示了使用 HyperParameters 组件记录数据的示例,代码见[HyperParameters组件](https://github.com/PaddlePaddle/VisualDL/blob/develop/demo/components/hparams_test.py)
```python
from visualdl import LogWriter
# 此demo演示了两次实验的超参数记录,以第一次实验数据为例,首先在`add_hparams`接口中记录
# 超参数`hparams`的数据,再标定了稍后要记录的`metrics`名称,最后通过`add_scalar`再具体
# 记录`metrics`的数据。此处需注意`add_hparams`接口中的`metrics_list`参数需要包含`add_scalar`
# 接口的`tag`参数。
if __name__ == '__main__':
# 记录第一次实验数据
with LogWriter('./log/hparams_test/train/run1') as writer:
# 记录hparams数值和metrics名称
writer.add_hparams(hparams_dict={'lr': 0.1, 'bsize': 1, 'opt': 'sgd'},
metrics_list=['hparam/accuracy', 'hparam/loss'])
# 通过将add_scalar接口中的tag与metrics名称对应,记录一次实验中不同step的metrics数值
for i in range(10):
writer.add_scalar(tag='hparam/accuracy', value=i, step=i)
writer.add_scalar(tag='hparam/loss', value=2*i, step=i)
# 记录第二次实验数据
with LogWriter('./log/hparams_test/train/run2') as writer:
# 记录hparams数值和metrics名称
writer.add_hparams(hparams_dict={'lr': 0.2, 'bsize': 2, 'opt': 'relu'},
metrics_list=['hparam/accuracy', 'hparam/loss'])
# 通过将add_scalar接口中的tag与metrics名称对应,记录一次实验中不同step的metrics数值
for i in range(10):
writer.add_scalar(tag='hparam/accuracy', value=1.0/(i+1), step=i)
writer.add_scalar(tag='hparam/loss', value=5*i, step=i)
```
运行上述程序后,在命令行执行
```shell
visualdl --logdir ./log --port 8080
```
接着在浏览器打开`http://127.0.0.1:8080`,即可查看超参数可视化信息。
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119247155-e9c0c280-bbb9-11eb-8175-58a9c7657a9c.gif" width="85%"/>
</p>
### 功能操作说明 ### 功能操作说明
* 支持选择特定实验数据进行展示,且支持根据所选择的数据标签进行展示 * 表格视图
- 表格视图可选择按照某一项排序展示。
- Trial ID表示某次具体的实验名,其他正常字体展示的列名为超参数名,加粗字体展示的列名为度量指标名。
- 超参数和度量指标的位置可通过拖动的方式自定义。
- 表格视图的列宽可拖动调整。
- 可通过点击展开查看度量指标的变化趋势折线图。
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/48054808/103191809-4e306c00-4911-11eb-853f-e143ef86e182.png" width="30%"/> <img src="https://user-images.githubusercontent.com/28444161/119219705-75364700-bb19-11eb-9077-064337ae95be.png" width="85%"/>
</p> </p>
* 降维方式--TSNE * 平行坐标图
- 可通过悬停展示某组实验中超参数和度量指标的具体值。
- 可通过选中某条曲线展示此组实验中度量指标的变化趋势折线图。
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/48054808/103192762-cea49c00-4914-11eb-896c-070b0bf0e2ea.png" width="27%"/> <img src="https://user-images.githubusercontent.com/28444161/119221098-440d4500-bb20-11eb-8b26-d29f95147c04.png" width="85%"/>
</p> </p>
* 降维方式--PCA * 散点图
- 可通过悬停展示某组实验中超参数和度量指标的具体值。
- 可通过选中某个点展示此组实验中度量指标的变化趋势折线图。
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/48054808/103192341-47a2f400-4913-11eb-9995-fdc0acadbdc9.png" width="27%"/> <img src="https://user-images.githubusercontent.com/28444161/119221108-54252480-bb20-11eb-9a8f-1d082c36402b.png" width="85%"/>
</p> </p>
* 降维方式--UMAP * 度量指标变化趋势折线图
- 表格视图、平行坐标图和散点图下均可查看
- 此处查看的度量指标变化趋势折线图同样可在`SCALARS`面板下查看
<p align="center"> <p align="center">
<img src="https://user-images.githubusercontent.com/48054808/103192766-d2d0b980-4914-11eb-871e-e4b31542c5e9.png" width="27%"/> <img src="https://user-images.githubusercontent.com/28444161/119221127-6901b800-bb20-11eb-84f0-407bd7241bc7.png" width="85%"/>
</p> </p>
* 超参数/度量指标范围选择
- 通过选择超参数或度量指标的范围以展示部分数据
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119221141-78810100-bb20-11eb-9e06-5b345459310a.png" width="20%"/>
</p>
* 下载数据
- 可选择CSV或TSV两种格式
<p align="center">
<img src="https://user-images.githubusercontent.com/28444161/119221157-8b93d100-bb20-11eb-9c9e-7540b3cb92a1.png" width="20%"/>
</p>
## VDL.service ## VDL.service
### 简介 ### 简介
......
...@@ -442,14 +442,14 @@ class LogWriter(object): ...@@ -442,14 +442,14 @@ class LogWriter(object):
step=step, step=step,
walltime=walltime)) walltime=walltime))
def add_hparams(self, hparam_dict, metric_list, walltime=None): def add_hparams(self, hparams_dict, metrics_list, walltime=None):
"""Add an histogram to vdl record file. """Add an histogram to vdl record file.
Args: Args:
hparam_dict (dictionary): Each key-value pair in the dictionary is the hparams_dict (dictionary): Each key-value pair in the dictionary is the
name of the hyper parameter and it's corresponding value. The type of the value name of the hyper parameter and it's corresponding value. The type of the value
can be one of `bool`, `string`, `float`, `int`, or `None`. can be one of `string`, `float` or `int`.
metric_list (list): Name of all metrics. metrics_list (list): Name of all metrics.
walltime (int): Wall time of hparams. walltime (int): Wall time of hparams.
Examples:: Examples::
...@@ -468,17 +468,17 @@ class LogWriter(object): ...@@ -468,17 +468,17 @@ class LogWriter(object):
writer.add_scalar('hparam/accuracy', 1.0/(i+1), i) writer.add_scalar('hparam/accuracy', 1.0/(i+1), i)
writer.add_scalar('hparam/loss', 5*i, i) writer.add_scalar('hparam/loss', 5*i, i)
""" """
if type(hparam_dict) is not dict: if type(hparams_dict) is not dict:
raise TypeError('hparam_dict should be dictionary.') raise TypeError('hparam_dict should be dictionary!')
if type(metric_list) is not list: if type(metrics_list) is not list:
raise TypeError('metric_list should be list.') raise TypeError('metric_list should be list!')
walltime = round(time.time() * 1000) if walltime is None else walltime walltime = round(time.time() * 1000) if walltime is None else walltime
self._get_file_writer().add_record( self._get_file_writer().add_record(
hparam( hparam(
name=md5(self.file_name), name=md5(self.file_name),
hparam_dict=hparam_dict, hparam_dict=hparams_dict,
metric_list=metric_list, metric_list=metrics_list,
walltime=walltime)) walltime=walltime))
def add_pr_curve(self, def add_pr_curve(self,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册