# abrehamt/mnist_nn architecture

> Architecture diagram of the GitHub repository abrehamt/mnist_nn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abrehamt/mnist_nn
- Repository: https://github.com/abrehamt/mnist_nn

## Overview

##### Main Components
- Data Source: Represent the MNIST.csv file as the primary data source. This file contains the preprocessed image data.
- Data Ingestion/Preprocessing: Indicate a module or block (likely within HW_5.py or within the Jupyter Notebook HW 5.ipynb) that reads the CSV data and prepares it for training/testing.
- Neural Network Model:
- Input Layer: Specify an input layer with 784 nodes, corresponding to the 784 pixels of an image.
- Hidden Layer: Highlight the hidden layer that uses the ReLU activation function.
- Training & Evaluation: Create a block detailing the training phase where the model utilizes the adam optimizer and a SparseCategoricalCrossEntropy loss function. Show how model training is performed and how performance metrics (accuracies over folds) and learning curves are generated.

##### Relationships and Interactions
- A flow from preprocessed data to the Neural Network Model, highlighting how data moves from input through hidden processing to output.
- Optionally, illustrate a feedback loop that represents the iterative training process (e.g., across different folds for cross-validation).

##### Architectural Patterns and Design Principles
- Clearly differentiate between data handling (CSV ingestion/preprocessing) and the model architecture (layers of the network).
- That the design uses a single hidden layer configuration as the optimal structure found for this task.

##### Relevant Technologies and Libraries
- Reference Python since the project is implemented with Python scripts and Jupyter Notebook.
- Although not explicitly mentioned, you might want to annotate that common libraries (such as numpy, pandas, and a machine learning framework like TensorFlow or Keras) may be in use, inferred from the methods described in the README.

## Diagram (Mermaid)

```mermaid
flowchart TD
    DS["Data Source: MNIST.csv"]:::data
    subgraph "Data Ingestion/Preprocessing"
        PY["Script: HW_5.py"]:::process
        NB["Notebook: HW 5.ipynb"]:::process
    end
    subgraph "Neural Network Model"
        IN["Input Layer (784 nodes)"]:::model
        HL["Hidden Layer (ReLU activation)"]:::model
        OUT["Output Layer (10 nodes with softmax)"]:::model
    end
    TE["Training & Evaluation"]:::eval

    DS -->|"reads"| PY
    DS -->|"reads"| NB
    PY -->|"preprocesses"| IN
    NB -->|"preprocesses"| IN
    IN -->|"feeds"| HL
    HL -->|"feeds"| OUT
    OUT -->|"trains"| TE
    TE -->|"updates"| IN

    click DS "https://github.com/abrehamt/mnist_nn/blob/main/MNIST.csv"
    click PY "https://github.com/abrehamt/mnist_nn/blob/main/HW_5.py"
    click NB "https://github.com/abrehamt/mnist_nn/blob/main/HW 5.ipynb"
    click IN "https://github.com/abrehamt/mnist_nn/blob/main/HW_5.py"
    click HL "https://github.com/abrehamt/mnist_nn/blob/main/HW_5.py"
    click OUT "https://github.com/abrehamt/mnist_nn/blob/main/HW_5.py"
    click TE "https://github.com/abrehamt/mnist_nn/blob/main/HW_5.py"

    classDef data fill:#ffe6e6,stroke:#ff0000,stroke-width:2px;
    classDef process fill:#e6f2ff,stroke:#1a75ff,stroke-width:2px;
    classDef model fill:#e6ffe6,stroke:#33cc33,stroke-width:2px;
    classDef eval fill:#fff0b3,stroke:#ffaa00,stroke-width:2px;
```
