alexlenail / NN-SVG

Publication-ready NN-architecture schematics.
http://alexlenail.me/NN-SVG/
MIT License
4.48k stars 578 forks source link

Bias should be added to input layer #45

Open ErikSchulze1796 opened 2 years ago

ErikSchulze1796 commented 2 years ago

Hello Alex,

I am fairly new to the field of machine learning and found your awesome tool for NN visualization during my research. One thing that came to my mind when ticking the "Show bias button" is that the bias is not added to the input layer, or am I wrong? I get that the input features are no "real" layer but shouldn't be the bias added to the input of each neuron of each layer after the input layer, or am I wrong?

Greetings from Germany! Erik

alexlenail commented 2 years ago

Hi @ErikSchulze1796

Bias in the input layer is represented. It's less obvious which node is the bias in the input layer -- it could be any of them - since what distinguishes a bias unit in subsequent layers is the absence of inputs from the previous layer, but none of the units in the input layer get inputs from a previous layer because there isn't a previous layer.

Maybe we should be explicitly coloring the bias unit gray or something..

ErikSchulze1796 commented 2 years ago

Oh yes, I see it now. You're completely right. It was just a bit confusing since it was not directly distinguishable from the other nodes. Thanks for the quick answer!

tirtho109 commented 3 months ago

Hi @alexlenail, Thanks for the clarification. But still I have some doubt. From my understanding, bias should not be considered as a dimension of a particular layer. Please let me know, if I got it wrong? Show Layer Labels should give one less dimension for each layer. Thanks!

alexlenail commented 3 months ago

@tirtho109 that's a good point. When the bias units are drawn the layer labels should be updated as well -- good catch. I'll gladly accept a PR for this.