ubuntu 下 Graphviz 的安装及神经网络的绘图

ubuntu 下 Graphviz 的安装

sudo apt-get install graphviz

神经网络的绘图

touch nn.dot
vim nn.dot

编辑如下内容:

digraph G { 
    rankdir=LR 
    splines=line 
    nodesep=.05; 
    node [label=""]; 

    subgraph cluster_0 { 
        color=white; 
        node [style=solid,color=blue4, shape=circle]; 
        x1 x2 x3; 
        label = "layer 1"; 
    } 

    subgraph cluster_1 { 
        color=white; 
        node [style=solid,color=red2, shape=circle]; 
        a12 a22 a32 a42 a52; 
        label = "layer 2"; 
    } 

    subgraph cluster_2 { 
        color=white; 
        node [style=solid,color=red2, shape=circle]; 
        a13 a23 a33 a43 a53; 
        label = "layer 3"; 
    } 
    subgraph cluster_3 {
        color=white; 
        node [style=solid,color=seagreen2, shape=circle]; 
        O1 O2 O3 O4;
        label="layer 4"; 
    } 

    x1 -> a12 
    x1 -> a22
    x1 -> a32
    x1 -> a42 
    x1 -> a52 

    x2 -> a12 
    x2 -> a22 
    x2 -> a32 
    x2 -> a42 
    x2 -> a52 

    x3 -> a12 
    x3 -> a22 
    x3 -> a32 
    x3 -> a42 
    x3 -> a52 

    a12 -> a13 
    a22 -> a13 
    a32 -> a13 
    a42 -> a13 
    a52 -> a13 

    a12 -> a23 
    a22 -> a23 
    a32 -> a23 
    a42 -> a23 
    a52 -> a23 

    a12 -> a33 
    a22 -> a33 
    a32 -> a33 
    a42 -> a33 
    a52 -> a33 

    a12 -> a43 
    a22 -> a43 
    a32 -> a43 
    a42 -> a43 
    a52 -> a43 

    a12 -> a53 
    a22 -> a53 
    a32 -> a53 
    a42 -> a53 
    a52 -> a53 

    a13 -> O1 
    a23 -> O1 
    a33 -> O1 
    a43 -> O1 
    a53 -> O1 

    a13 -> O2 
    a23 -> O2 
    a33 -> O2 
    a43 -> O2 
    a53 -> O2 

    a13 -> O3 
    a23 -> O3 
    a33 -> O3 
    a43 -> O3 
    a53 -> O3 

    a13 -> O4 
    a23 -> O4 
    a33 -> O4 
    a43 -> O4 
    a53 -> O4 
}

运行:

dot -Tsvg nn.dot -o nn.svg
        # dot -Tpng nn.dot -o nn.png 图片格式可设

得到的svg文件如下:


这里写图片描述

References

[1] 神经网络结构图专业的画图工具

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

五道口纳什

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值