Home > Mobile >  Tool for drawing neural networks
Tool for drawing neural networks

Time:12-18

I am trying to find a tool to replicate the following neural network graph:

enter image description here

The nodes and edges can be easily drawn with igraph. However, I am not sure whether igraph can be used to replicate the other parts of the figure. Could you please help me?

CodePudding user response:

If you are looking for such a solution like this example: You can find it here: enter image description here

CodePudding user response:

I think DiagrammeR can be a nicer variant.

If you want to produce it into R-enviroment. But you need some amount of time to learn this package.

library(DiagrammeR)

grViz("digraph G1 {
  graph [layout=neato overlap = true]     
  I0 [pos='1,3.25!' shape=plaintext label='input layer' fontsize=20]
  I1 [pos='1,2.5!'  style=radial]  
  I2 [pos='1,1!'    style=radial]
  I3 [pos='1,-0.5!' style=radial]
  I7 [pos='0,2.5!'  shape=plaintext label='input 1']
  I8 [pos='0,1!'    shape=plaintext label='input 2']
  I9 [pos='0,-0.5!' shape=plaintext label='input 3']
  H0 [pos='3,3.25!' shape=plaintext label='hidden layer 1' fontsize=20]
  H1 [pos='3,2.5!' style=radial]     
  H2 [pos='3,1!'    style=radial]
  H3 [pos='3,-0.5!' style=radial]
  O0 [pos='5,3.25!' shape=plaintext label='output layer' fontsize=20]
  O1 [pos='5,0!'  style=radial]
  O2 [pos='5,2!'  style=radial] 
  O7 [pos='6,0!' shape=plaintext label='output']
  O8 [pos='6,2!' shape=plaintext label='output']
  
  I7 -> I1 
  I8 -> I2
  I9 -> I3
  I1 -> H1 [label='w=0.8']
  I1 -> {H2 H3}
  I2 -> {H1 H2 H3}
  I3 -> {H1 H2 H3}
  {H1 H2 H3} -> O1
  {H1 H2 H3} -> O2
  O1 -> O7
  O2 -> O8
  
}")

enter image description here

I don't know how to make a 'vertical arrow to arrows', but I think we can do it via label...

  • Related