Metadata-Version: 2.4
Name: neural-network-draw
Version: 0.2.0
Summary: Draw basic feed-forward neural network architecture diagrams with matplotlib
Author-email: Your Name <your.email@example.com>
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: matplotlib>=3.7
Dynamic: license-file
Dynamic: requires-python


# neural_network_draw

A Python library for **visualizing neural network architectures** using matplotlib.

This project focuses on **rendering neural networks as diagrams**, not training or running models.

It supports both:

*  Low-level step-by-step network building (`NeuralNetwork`)
*  High-level one-call architecture visualization (`DrawNN`)

---

#  What this library does

This library converts a neural network definition into a **visual graph representation**, including:

* Layers and neurons
* Connections between neurons
* Optional weights visualization
* Bias values
* Activation labels
* Input/output annotations
* Clean, publication-ready diagrams

---

#  What this library does NOT do

* It does NOT train neural networks
* It does NOT perform inference
* It does NOT use deep learning frameworks like PyTorch or TensorFlow

It is purely a **visualization + education tool**.

---

#  Architecture Overview

The project has two main APIs:

## 1.  `NeuralNetwork` (Low-level API)

A step-by-step builder for full control over each layer.

### Example:

```python
network = NeuralNetwork(4)

network.add_layer(3, labels=["pixel_1", "pixel_2", "pixel_3"])

network.add_layer(
    4,
    weights=[
        [0.10, -0.20, 0.30, 0.40],
        [0.50, 0.60, -0.70, 0.80],
        [-0.10, 0.20, 0.30, -0.40],
    ],
    biases=[0.10, 0.20, 0.30, 0.40],
    activation="ReLU",
)

network.add_layer(
    2,
    weights=[
        [0.20, -0.30],
        [0.10, 0.40],
        [0.50, -0.60],
        [0.20, 0.10],
    ],
    biases=[0.05, -0.05],
    activation="Softmax",
    labels=["Cat", "Dog"],
)

network.draw(show_weights=True)
```
![alt text](image.png)

---

## 2.  `DrawNN` (High-level API)

![alt text](image-1.png)

## 3. Labeled structure

![alt text](image-2.png)

A simplified interface for quickly defining architectures.

### Example:

```python
dnn = DrawNN(
    [3, 4, 2],
    weights=[...],
    biases=[None, [...], [...]],
    activations=[None, "ReLU", "Softmax"],
    input_labels=["x1", "x2", "x3"],
    output_labels=["Cat", "Dog"],
    title="High-Level API Example",
)

dnn.draw(show_weights=True)
```

---

#  Visualization Features

##  Network structure rendering

* Fully automatic layer spacing
* Centered neuron layout

##  Weights display

* Optional numeric display
* Color/thickness encodes magnitude & sign

##  Bias visualization

* Shown per neuron (optional)
* Supports partial or full specification

##  Activation labels

* ReLU
* Softmax
* Sigmoid
* Custom strings supported

##  Input / output labeling

* Human-readable feature names
* Class labels or regression outputs


---
#  Dependencies

* Python 3.8+
* matplotlib
* numpy (if used internally in layout logic)

---

#  Key Design Philosophy

This library is designed to be:

>  A **visual compiler for neural network architectures**

It transforms structured model definitions into **clean educational diagrams**.

---

#  Use Cases

* Teaching neural networks
* Explaining architectures in blogs
* ML presentations
* Debugging model structure
* Portfolio visualization tools

---


* Interactive zoom/hover tooltips
* SVG / web export (React-friendly)
* Auto-generation from PyTorch models
* Animation of forward pass
* Graph-based auto-layout improvements

---


