Skip to main content

A library to draw neural networks based on user parameters

Project description

ndraw

ndraw is a Python package that allows users to visualize neural networks easily.

Installation

Install ndraw using pip:

pip install nndraw

Usage

from ndraw.drawing import draw_neural_network

# Define the neural network structure
parameters = {
    "input_neurons": (20, "lightblue", True),  # 20 input nodes, colored light blue, with labels
    "hidden_layers": [
        (3, "ReLU", "lightgreen", True),  # 3 hidden nodes, ReLU activation, light green, labeled
        (4, "ReLU", False)  # 4 hidden nodes, ReLU activation, default color, no labels
    ],  
    "output_neurons": (2, "Softmax", "red", True),  # 2 output nodes, Softmax activation, red, labeled
    "directed_edges": False  # If False, edges are undirected; if True, edges are directed
}  

# Call the function with unpacked parameters
draw_neural_network(**parameters)

Parameters Explained

input_neurons - Tuple (num_nodes, color, labels), defining the number of input neurons, their color, and whether labels are displayed. hidden_layers - List of tuples (num_nodes, activation, color, labels), where each tuple defines a hidden layer. output_neurons - Tuple (num_nodes, activation, color, labels), specifying the number of output neurons, their activation function, color, and labels. directed_edges - Boolean (True or False), indicating whether edges between neurons should be directed (arrows) or undirected (lines).

Notes

  • If a color is not provided, the default color (e.g., "grey") is used.
  • Activation functions are for visualization purposes only (they are not applied computationally).

License

This project is licensed under the MIT License.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

NNDraw-0.1.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file NNDraw-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: NNDraw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for NNDraw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee26281d32c26a2164fd2dab1521e6ff9c927d5d107012b8ff8efef491e0699a
MD5 37bab5d0243634dd74d64ed299341e9a
BLAKE2b-256 d7416f0339c9ccc65a8f6720a79f4da83d401ca0cb63dd6fa2e8ebe852628cdf

See more details on using hashes here.

Supported by

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