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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee26281d32c26a2164fd2dab1521e6ff9c927d5d107012b8ff8efef491e0699a
|
|
| MD5 |
37bab5d0243634dd74d64ed299341e9a
|
|
| BLAKE2b-256 |
d7416f0339c9ccc65a8f6720a79f4da83d401ca0cb63dd6fa2e8ebe852628cdf
|