Skip to main content

NNtecture is a Python package for Neural Network architecture visualization.

Project description

3D fonts


PyPI Version License

NNtecture is a Python package for Neural Network architecture visualization.


Install

NNtecture package runs under Python 3.6+. It can be installed from PyPI:

pip install nntecture

To render the generated DOT source code, you also need to install Graphviz (download page).

Make sure that the directory containing the dot executable is on your systems' path.


Tutorial

Basic Usage

After installation, the package is ready to be imported.

from nntecture import DrawNN

Creating your Neural Network architecture with NNtecture is designed to be as easy and intuitive as possible. Drawing a simple architecture can be done in a single line of code (see below).

DrawNN([2, 4, 4, 2]).draw()

Built In Customization

The capabilities are not limited into this base form. The architecture can be easily customised as demonstrated in below example.

# init
nn = DrawNN([3, 3, 3, 3], nn_type='RNN')

# draw
nn.draw(fillcolor='#AF628F',
        graph_label='Recurrent Neural Network (RNN)',
        linewidth=0.5,
        fontname='times',
        node_labels=True,
        node_fontcolor='#ffffff')

Saving Results

Once satisfied with the architecture, the results can be saved into your desired form.

# create your architecture
perceptron = DrawNN([2, 1])
perceptron.draw(graph_label='Perceptron (P)', fillcolor='lightblue', linewidth=4)

# save to file
perceptron.save(filename='perceptron', output_format='jpg', size='5,5!', view=True)

Advanced Customization Capabilities

Styling your architecture is not limited into the built-in capabilities. In addition, by accessing graph_object, one can further customise the drawing with graphviz (see example below). For more instructions, see graphviz documentation.

# init
nn = DrawNN([4, 3, 2, 1])
nn.draw(direction='UD', fillcolor='blue')

# further customization
nn.graph_object.edge_attr["style"] = "setlinewidth(2)"
nn.graph_object.edge_attr['color'] = 'purple'
nn.graph_object.graph_attr['bgcolor'] = 'black'
nn.graph_object.node_attr["color"] = "white"

# display
nn.graph_object

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nntecture-1.0.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

nntecture-1.0.0-py2.py3-none-any.whl (6.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file nntecture-1.0.0.tar.gz.

File metadata

  • Download URL: nntecture-1.0.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.2

File hashes

Hashes for nntecture-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4beb1da44e3e9f9ac733ad51e6e0a258699dc037a0e9d7649c7a6d7e4924fd2a
MD5 9f3933b7cb47085a87c79c237d6fa9b6
BLAKE2b-256 88c36285456bcb797362fc090767cfccfb01c90829ac98fce81714b2450344d0

See more details on using hashes here.

File details

Details for the file nntecture-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: nntecture-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.2

File hashes

Hashes for nntecture-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 117cf1b1e39bd548e6018e236d586b01155e0576b1cbedf4533879f6f079c0f4
MD5 8abc76577cc84b0a55fd510c12c141a4
BLAKE2b-256 a8bb0c610d830cf85098a49205d20c9634e796091e163b50c02481177b137589

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page