【问题标题】:How to plot parallel coordinae plot ftrom Hyperparameter Tuning with the HParams Dashboard?如何使用 HParams 仪表板从超参数调整中绘制平行坐标图?
【发布时间】:2020-09-10 23:08:32
【问题描述】:

我正在尝试在这个 Tensorflow tutorial 中复制超参数调整教程中的平行坐标图,并且我已经编写了自己的 csv 文件来存储我的结果。 我读取 csv 文件的输出是这样的:

    conv_layers  filters  dropout  accuracy
0             4       16      0.5  0.447917
1             4       16      0.6  0.458333
2             4       32      0.5  0.635417
3             4       32      0.6  0.447917
4             4       64      0.5  0.604167
5             4       64      0.6  0.645833
6             8       16      0.5  0.437500
7             8       16      0.6  0.437500
8             8       32      0.5  0.437500
9             8       32      0.6  0.562500
10            8       64      0.5  0.562500
11            8       64      0.6  0.437500

如何在 python 中创建与教程中相同的绘图?

【问题讨论】:

    标签: tensorboard tensorflow-serving hyperparameters


    【解决方案1】:

    所以我使用 plotly 找到了答案

    import os
    import sys
    import pandas as pd
    from plotly.offline import init_notebook_mode, iplot
    import plotly.graph_objects as go
    
    init_notebook_mode(connected=True)
    
    df = pd.read_csv('path/to/csv')
    
    fig = go.Figure(data=
        go.Parcoords(
            line = dict(color = df['accuracy'],
                      colorbar = [],
                       colorscale = [[0, '#6C9E12'], ## 
                                    [0.25,'#0D5F67'], ##
                                    [0.5,'#AA1B13'], ## 
                                    [0.75, '#69178C'], ## 
                                    [1, '#DE9733']]),
            dimensions = list([
                dict(range = [0,12],
                    label = 'Conv_layers', values = df['conv_layers']),
                dict(range = [8,64],
                    label = 'filter_number', values = df['filters']),
                dict(range = [0.2,0.8],
                    label = 'dropout_rate', values = df['dropout']),
                dict(range = [0.2,0.8],
                    label = 'dense_num', values = df['dense']),
                 dict(range = [0.1,1.0],
                    label = 'accuracy', values = df['accuracy'])
            ])
        )
    )
    
    
    fig.update_layout(
        plot_bgcolor = '#E5E5E5',
        paper_bgcolor = '#E5E5E5',    
        title="Parallel Coordinates Plot"
    )
    
    # print the plot
    fig.show()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-25
      • 2014-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多