使用 texttable可视化

    print(args)

Namespace(batch_size=32, capsule_dimensions=8, epochs=100, gcn_filters=20, gcn_layers=2, inner_attention_dimension=20, lambd=0.5, learning_rate=0.001, number_of_capsules=8, prediction_path=’…/output/watts_predictions.csv’, test_graph_folder=’…/input/test/’, theta=0.1, train_graph_folder=’…/input/train/’, weight_decay=1e-06)

vars 将对象的属性键值变成dict字典

    args = vars(args)
    print(args)

{‘train_graph_folder’: ‘…/input/train/’, ‘test_graph_folder’: ‘…/input/test/’, ‘prediction_path’: ‘…/output/watts_predictions.csv’, ‘epochs’: 100, ‘batch_size’: 32, ‘gcn_filters’: 20, ‘gcn_layers’: 2, ‘inner_attention_dimension’: 20, ‘capsule_dimensions’: 8, ‘number_of_capsules’: 8, ‘weight_decay’: 1e-06, ‘learning_rate’: 0.001, ‘lambd’: 0.5, ‘theta’: 0.1}

将字典排序后变成列表的列表

    keys = sorted(args.keys())
    rows = [["Parameter", "Value"]] + [[k.replace("_"," ").capitalize(),args[k]] for k in keys]
    print(rows)

[[‘Parameter’, ‘Value’], [‘Batch size’, 32], [‘Capsule dimensions’, 8], [‘Epochs’, 100], [‘Gcn filters’, 20], [‘Gcn layers’, 2], [‘Inner attention dimension’, 20], [‘Lambd’, 0.5], [‘Learning rate’, 0.001], [‘Number of capsules’, 8], [‘Prediction path’, ‘…/output/watts_predictions.csv’], [‘Test graph folder’, ‘…/input/test/’], [‘Theta’, 0.1], [‘Train graph folder’, ‘…/input/train/’], [‘Weight decay’, 1e-06]]

将列表输入texttable 可视化打印

    t = Texttable()
    t.add_rows(rows)
    print(t.draw())
+---------------------------+---------------------------------+
|         Parameter         |              Value              |
+===========================+=================================+
| Batch size                | 32                              |
+---------------------------+---------------------------------+
| Capsule dimensions        | 8                               |
+---------------------------+---------------------------------+
| Epochs                    | 100                             |
+---------------------------+---------------------------------+
| Gcn filters               | 20                              |
+---------------------------+---------------------------------+
| Gcn layers                | 2                               |
+---------------------------+---------------------------------+
| Inner attention dimension | 20                              |
+---------------------------+---------------------------------+
| Lambd                     | 0.500                           |
+---------------------------+---------------------------------+
| Learning rate             | 0.001                           |
+---------------------------+---------------------------------+
| Number of capsules        | 8                               |
+---------------------------+---------------------------------+
| Prediction path           | ../output/watts_predictions.csv |
+---------------------------+---------------------------------+
| Test graph folder         | ../input/test/                  |
+---------------------------+---------------------------------+
| Theta                     | 0.100                           |
+---------------------------+---------------------------------+
| Train graph folder        | ../input/train/                 |
+---------------------------+---------------------------------+
| Weight decay              | 0.000                           |
+---------------------------+---------------------------------+
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

颹蕭蕭

白嫖?

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值