Skip to main content

Neural Network Visualizer (NNV)

Simple and easy to use tool to generate Neural Network Visualizations.

Installation

pip install nnv

Usage

from nnv import NNV

layersList = [
    {"title":"input\n(relu)", "units": 3, "color": "darkBlue"},
    {"title":"hidden 1\n(relu)", "units": 3},
    {"title":"hidden 2\n(relu)", "units": 3,"edges_color":"red", "edges_width":2},
    {"title":"output\n(sigmoid)", "units": 1,"color": "darkBlue"},
]

NNV(layersList).render()

alt text

It is possible to customize the node size/colors, title font size, spacing between nodes and layers and maximum number of nodes to show,...

from nnv import NNV

# Let's increase the size of the plot
import matplotlib.pyplot as plt
plt.rcParams["figure.figsize"] = (200,10)


layers_list = [
    {"title":"input\n(relu)", "units": 300, "color": "darkBlue"},
    {"title":"hidden 1\n(relu)", "units": 150},
    {"title":"hidden 2\n(relu)",  "units": 75},
    {"title":"Dropout\n(0.5)", "units": 75,"color":"lightGray"},
    {"title":"hidden 4\n(relu)",  "units": 18},
    {"title":"hidden 5\n(relu)",  "units": 9},
    {"title":"hidden 6\n(relu)",  "units": 4},
    {"title":"output\n(sigmoid)", "units": 1,"color": "darkBlue"},
]


NNV(layers_list, max_num_nodes_visible=8, node_radius=10, spacing_layer=60, font_size=24).render(save_to_file="my_example_2.pdf")

alt text

Documentation

NNV documentation is still being created. For now, if you have any question, please look directly the library source code or open an Issue.

Future addittions

Some useful features that may be added in the future (help is welcome):

  • add labels to each node
  • import layers info directly from a keras model

Citation

If you use this library and would like to cite it, you can use:

 R. Cordeiro, "NNV: Neural Network Visualizer", 2019. [Online]. Available: https://github.com/renatosc/nnv. [Accessed: DD- Month- 20YY].

or:

@Misc{,
  author = {Renato Cordeiro},
  title  = {NNV: Neural Network Visualizer},
  month  = may,
  year   = {2019},
  note   = {Online; accessed <today>},
  url    = {https://github.com/renatosc/nnv},
}

Metadata

Release files for nnv 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nnv 0.0.5
File Size Uploaded
nnv-0.0.5.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nnv 0.0.5
File Interpreter ABI Platform
nnv-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / nnv-0.0.5.tar.gz

Download URL nnv-0.0.5.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e6fb8d5c557f50115a1b886371e95bc2fe7d2b8c62da9bd22b3ff108e8152dc3
BLAKE2b-256 checksum
How to use checksums
06b3e44150a96655fb3dd0bb0566b52fd9bd28ddfbe68a7a6643090b96ba4aa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / nnv-0.0.5-py3-none-any.whl

Download URL nnv-0.0.5-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
978270a2b75690ce89807639e85564d7021e319bdb1a6bf6afd05bc5f288b592
BLAKE2b-256 checksum
How to use checksums
53f0e349b08525e6e0b3827b80e800541c19bcab788107332ca8f3dcae75debc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page