# mathangi18/lab-2 architecture

> Architecture diagram of the GitHub repository mathangi18/lab-2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mathangi18/lab-2
- Repository: https://github.com/mathangi18/lab-2

## Overview

CM2003 Lab 2 is a hands-on neural-network assignment, delivered through notebooks and a NumPy support package. Learners load CIFAR-10 or PneumoniaMNIST, implement and train fully connected or convolutional models, then evaluate results; the PyTorch notebook additionally covers medical-data metrics and training practices. The graph includes the documented optional batch-normalization and dropout exercises. Notebook internals were not sampled, so their links to package components are limited to relationships the README or source index establishes.

Main entry points: [`cm2003/classifiers/cnn.py`](https://github.com/mathangi18/lab-2/blob/main/cm2003/classifiers/cnn.py) (Convolutional model), [`cm2003/layer_utils.py`](https://github.com/mathangi18/lab-2/blob/main/cm2003/layer_utils.py) (Composite layer helpers), [`cm2003/fast_layers.py`](https://github.com/mathangi18/lab-2/blob/main/cm2003/fast_layers.py) (Fast convolution and pooling), [`cm2003/solver.py`](https://github.com/mathangi18/lab-2/blob/main/cm2003/solver.py) (Training solver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Lab notebooks"]
  node_fc_lab["Fully connected lab"]
  node_bn_lab["Batch normalization lab"]
  node_dropout_lab["Dropout lab<br/>[Dropout.ipynb]"]
  node_cnn_lab["Convolutional lab"]
  node_torch_lab["PyTorch medical lab<br/>[PyTorch.ipynb]"]
end

subgraph group_models["NumPy modeling"]
  node_fc_model["Fully connected models<br/>[fc_net.py]"]
  node_cnn_model["Convolutional model<br/>[cnn.py]"]
  node_layers["Layer operations<br/>[layers.py]"]
  node_layer_helpers["Composite layer helpers<br/>[layer_utils.py]"]
  node_fast_ops["Fast convolution and pooling<br/>[fast_layers.py]"]
  node_im2col["Im2col transforms<br/>[im2col.py]"]
  node_trainer["Training solver<br/>[solver.py]"]
  node_optimizers["Update rules<br/>[optim.py]"]
end

subgraph group_data["Data and utilities"]
  node_data_utils["CIFAR data helpers<br/>[data_utils.py]"]
  node_datasets[("CIFAR-10 and PneumoniaMNIST")]
  node_downloader["Dataset downloader<br/>[download_data.py]"]
  node_gradient_check["Gradient checking<br/>[gradient_check.py]"]
  node_image_utils["Image utilities<br/>[image_utils.py]"]
  node_visualization["Visualization utilities<br/>[vis_utils.py]"]
end

node_learner(("Learner"))

node_learner -->|"works through"| node_fc_lab
node_learner -->|"optionally implements"| node_bn_lab
node_learner -->|"explores"| node_dropout_lab
node_learner -->|"implements"| node_cnn_lab
node_learner -->|"trains and evaluates"| node_torch_lab
node_downloader -->|"downloads or copies"| node_datasets
node_fc_lab -->|"loads CIFAR-10"| node_datasets
node_torch_lab -->|"loads PneumoniaMNIST"| node_datasets
node_fc_model -->|"uses"| node_layers
node_fc_model -->|"uses"| node_layer_helpers
node_cnn_model -->|"uses"| node_layers
node_cnn_model -->|"uses"| node_fast_ops
node_cnn_model -->|"uses"| node_layer_helpers
node_layer_helpers -->|"calls"| node_layers
node_layer_helpers -->|"calls"| node_fast_ops
node_fast_ops -->|"uses transforms"| node_im2col
node_trainer -->|"dispatches updates"| node_optimizers
node_image_utils -->|"uses convolution"| node_fast_ops
node_trainer -.->|"trains model"| node_fc_model
node_trainer -.->|"trains model"| node_cnn_model

click node_fc_lab "https://github.com/mathangi18/lab-2/blob/main/FullyConnectedNets.ipynb"
click node_bn_lab "https://github.com/mathangi18/lab-2/blob/main/BatchNormalization.ipynb"
click node_dropout_lab "https://github.com/mathangi18/lab-2/blob/main/Dropout.ipynb"
click node_cnn_lab "https://github.com/mathangi18/lab-2/blob/main/ConvolutionalNetworks.ipynb"
click node_torch_lab "https://github.com/mathangi18/lab-2/blob/main/PyTorch.ipynb"
click node_fc_model "https://github.com/mathangi18/lab-2/blob/main/cm2003/classifiers/fc_net.py"
click node_cnn_model "https://github.com/mathangi18/lab-2/blob/main/cm2003/classifiers/cnn.py"
click node_layers "https://github.com/mathangi18/lab-2/blob/main/cm2003/layers.py"
click node_layer_helpers "https://github.com/mathangi18/lab-2/blob/main/cm2003/layer_utils.py"
click node_fast_ops "https://github.com/mathangi18/lab-2/blob/main/cm2003/fast_layers.py"
click node_im2col "https://github.com/mathangi18/lab-2/blob/main/cm2003/im2col.py"
click node_trainer "https://github.com/mathangi18/lab-2/blob/main/cm2003/solver.py"
click node_optimizers "https://github.com/mathangi18/lab-2/blob/main/cm2003/optim.py"
click node_data_utils "https://github.com/mathangi18/lab-2/blob/main/cm2003/data_utils.py"
click node_datasets "https://github.com/mathangi18/lab-2/tree/main/cm2003/datasets"
click node_downloader "https://github.com/mathangi18/lab-2/blob/main/download_data.py"
click node_gradient_check "https://github.com/mathangi18/lab-2/blob/main/cm2003/gradient_check.py"
click node_image_utils "https://github.com/mathangi18/lab-2/blob/main/cm2003/image_utils.py"
click node_visualization "https://github.com/mathangi18/lab-2/blob/main/cm2003/vis_utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_fc_lab,node_bn_lab,node_dropout_lab,node_cnn_lab,node_torch_lab toneBlue
class node_fc_model,node_cnn_model,node_layers,node_layer_helpers,node_fast_ops,node_im2col,node_trainer,node_optimizers toneAmber
class node_data_utils,node_datasets,node_downloader,node_gradient_check,node_image_utils,node_visualization toneMint
class node_learner toneIndigo
```

## Components

### Lab notebooks

- [Fully connected lab](https://github.com/mathangi18/lab-2/blob/main/FullyConnectedNets.ipynb): `FullyConnectedNets.ipynb`
- [Batch normalization lab](https://github.com/mathangi18/lab-2/blob/main/BatchNormalization.ipynb): `BatchNormalization.ipynb`
- [Dropout lab](https://github.com/mathangi18/lab-2/blob/main/Dropout.ipynb): `Dropout.ipynb`
- [Convolutional lab](https://github.com/mathangi18/lab-2/blob/main/ConvolutionalNetworks.ipynb): `ConvolutionalNetworks.ipynb`
- [PyTorch medical lab](https://github.com/mathangi18/lab-2/blob/main/PyTorch.ipynb): `PyTorch.ipynb`

### NumPy modeling

- [Fully connected models](https://github.com/mathangi18/lab-2/blob/main/cm2003/classifiers/fc_net.py): `cm2003/classifiers/fc_net.py`
- [Convolutional model](https://github.com/mathangi18/lab-2/blob/main/cm2003/classifiers/cnn.py): `cm2003/classifiers/cnn.py`
- [Layer operations](https://github.com/mathangi18/lab-2/blob/main/cm2003/layers.py): `cm2003/layers.py`
- [Composite layer helpers](https://github.com/mathangi18/lab-2/blob/main/cm2003/layer_utils.py): `cm2003/layer_utils.py`
- [Fast convolution and pooling](https://github.com/mathangi18/lab-2/blob/main/cm2003/fast_layers.py): `cm2003/fast_layers.py`
- [Im2col transforms](https://github.com/mathangi18/lab-2/blob/main/cm2003/im2col.py): `cm2003/im2col.py`
- [Training solver](https://github.com/mathangi18/lab-2/blob/main/cm2003/solver.py): `cm2003/solver.py`
- [Update rules](https://github.com/mathangi18/lab-2/blob/main/cm2003/optim.py): `cm2003/optim.py`

### Data and utilities

- [CIFAR data helpers](https://github.com/mathangi18/lab-2/blob/main/cm2003/data_utils.py): `cm2003/data_utils.py`
- [CIFAR-10 and PneumoniaMNIST](https://github.com/mathangi18/lab-2/tree/main/cm2003/datasets): `cm2003/datasets`
- [Dataset downloader](https://github.com/mathangi18/lab-2/blob/main/download_data.py): `download_data.py`
- [Gradient checking](https://github.com/mathangi18/lab-2/blob/main/cm2003/gradient_check.py): `cm2003/gradient_check.py`
- [Image utilities](https://github.com/mathangi18/lab-2/blob/main/cm2003/image_utils.py): `cm2003/image_utils.py`
- [Visualization utilities](https://github.com/mathangi18/lab-2/blob/main/cm2003/vis_utils.py): `cm2003/vis_utils.py`

### Other components

- **Learner**

## Connections

- Learner → Fully connected lab: works through (evidence: `README.md`)
- Learner → Batch normalization lab: optionally implements (evidence: `README.md`)
- Learner → Dropout lab: explores (evidence: `README.md`)
- Learner → Convolutional lab: implements (evidence: `README.md`)
- Learner → PyTorch medical lab: trains and evaluates (evidence: `README.md`)
- Dataset downloader → CIFAR-10 and PneumoniaMNIST: downloads or copies (evidence: `download_data.py`)
- Fully connected lab → CIFAR-10 and PneumoniaMNIST: loads CIFAR-10 (evidence: `README.md`)
- PyTorch medical lab → CIFAR-10 and PneumoniaMNIST: loads PneumoniaMNIST (evidence: `README.md`)
- Fully connected models → Layer operations: uses (evidence: `cm2003/classifiers/fc_net.py`)
- Fully connected models → Composite layer helpers: uses (evidence: `cm2003/classifiers/fc_net.py`)
- Convolutional model → Layer operations: uses (evidence: `cm2003/classifiers/cnn.py`)
- Convolutional model → Fast convolution and pooling: uses (evidence: `cm2003/classifiers/cnn.py`)
- Convolutional model → Composite layer helpers: uses (evidence: `cm2003/classifiers/cnn.py`)
- Composite layer helpers → Layer operations: calls (evidence: `cm2003/layer_utils.py`)
- Composite layer helpers → Fast convolution and pooling: calls (evidence: `cm2003/layer_utils.py`)
- Fast convolution and pooling → Im2col transforms: uses transforms (evidence: `cm2003/fast_layers.py`)
- Training solver → Update rules: dispatches updates (evidence: `cm2003/solver.py`)
- Image utilities → Fast convolution and pooling: uses convolution (evidence: `cm2003/image_utils.py`)
- Training solver → Fully connected models: trains model
- Training solver → Convolutional model: trains model
