YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Selected Models for SMAI Assignment 4 β Question 1
This repository contains the selected Multi-Layer Perceptron (MLP) and IOC-NN models evaluated on the CIFAR-10 dataset.
The MLP is implemented from scratch using NumPy, while the IOC-NN model is implemented using PyTorch.
1. Model Architectures
1.1 Multi-Layer Perceptron (MLP)
| Property | Description |
|---|---|
| Implementation | NumPy (from scratch) |
| Data Type | float64 |
| Architecture | 3072 β 64 β 10 |
| Hidden Activation | ReLU |
| Output Activation | Identity (Linear logits) |
| Number of Parameters | 197,322 |
| Validation Accuracy | 48.67% |
| Test Accuracy | 48.95% |
Model File: selected_mlp_cifar10.npz
1.2 IOC-NN
| Property | Description |
|---|---|
| Implementation | PyTorch (torch.nn) |
| Architecture | 3072 β 64 β 10 |
| Hidden Activation | ELU |
| Output Activation | Identity (Linear logits) |
| Number of Parameters | 197,322 |
| Test Accuracy (Clean, p = 0) | 45.52% |
| Best Epoch Test Accuracy | 50.66% |
Model Files:
selected_iocnn_cifar10.npzselected_iocnn_cifar10_state_dict.pth
Weight Constraints
For the IOC-NN model, the weights of layers with index $\ell \geq 2$ are constrained to be non-negative:
The constraint is enforced using the following projection:
2. Dataset and Preprocessing
Both models use the CIFAR-10 dataset, which consists of RGB images of dimensions $32 \times 32$.
2.1 Input Dimensions
Each image is flattened into a one-dimensional feature vector:
Therefore, the input dimension of both models is:
2.2 Pixel Scaling
The original pixel values are integers in the range $[0,255]$.
They are scaled to the range $[0,1]$ using:
The resulting data is represented using float64.
2.3 Feature Standardization
After scaling, the input features are standardized column-wise using the mean and standard deviation calculated exclusively from the training split.
The standardization formula is:
where:
- $x_{\text{scaled}}$ represents the scaled input feature.
- $\mu_{\text{train}}$ represents the training-set mean.
- $\sigma_{\text{train}}$ represents the training-set standard deviation.
- $x_{\text{norm}}$ represents the standardized feature.
Note: Validation and test data use the same training-set statistics for standardization. Their own means and standard deviations are not used, preventing data leakage.
3. Model Summary
Both selected models use the same architecture:
The primary differences are their implementations and hidden-layer activation functions:
| Feature | MLP | IOC-NN |
|---|---|---|
| Framework | NumPy | PyTorch |
| Hidden Activation | ReLU | ELU |
| Output Activation | Identity | Identity |
| Weight Constraints | Not specified | Non-negative weights for $\ell \geq 2$ |
Both models produce 10 output logits corresponding to the 10 CIFAR-10 classes.