Metadata-Version: 2.4
Name: tensor-flow-assignments
Version: 0.1.0
Summary: Deep Learning lab assignments (MLPs, regularisation, activations, CNNs, RNN/LSTM, transfer learning, hyperparameter tuning) as runnable TensorFlow scripts.
Author: Shreenath Kadam
License-Expression: MIT
Keywords: deep-learning,tensorflow,keras,assignments,mnist,lstm,transfer-learning
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Education
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tensorflow>=2.16
Requires-Dist: tensorboard
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: matplotlib
Requires-Dist: scikit-learn
Dynamic: license-file

# tensor-flow-assignments

Deep Learning lab assignments written as runnable TensorFlow/Keras scripts. Each assignment is a
standalone Python module that you can run from the command line or import.

| ID | Assignment | Data needed |
|---|---|---|
| 2 | MLP comparison: 1 hidden layer + ReLU vs 2 hidden layers + Tanh | Fashion-MNIST CSVs |
| 3 | Regularization: baseline vs L2 vs Dropout | Fashion-MNIST CSVs |
| 4 | Activation functions: Sigmoid vs Tanh vs ReLU | Fashion-MNIST CSVs |
| 5b | CNN vs MLP with data augmentation | CIFAR-10 image folders |
| 6a | LSTM for IMDB sentiment classification | IMDB Dataset.csv |
| 6b | Simple RNN for IMDB sentiment classification | IMDB Dataset.csv |
| 7a | Transfer learning with ResNet50 (cats vs dogs) | cats_and_dogs_filtered |
| 7b | Transfer learning with VGG16 (cats vs dogs) | cats_and_dogs_filtered |
| 8 | Hyperparameter tuning with TensorBoard logging | Fashion-MNIST CSVs |

## Installation

```bash
pip install tensor-flow-assignments
```

Requires Python 3.10 or newer. TensorFlow, NumPy, pandas, Matplotlib and scikit-learn are installed
automatically.

## Usage

The package installs a `tensor_flow_` command:

```bash
tensor_flow_ list                       # show all assignments
tensor_flow_ run 4 --help               # options for one assignment
tensor_flow_ run 4                      # run with the default file names in the current folder
tensor_flow_ run 2 --train-csv data/fashion-mnist_train.csv --test-csv data/fashion-mnist_test.csv
tensor_flow_ run 6a --csv "IMDB Dataset.csv" --epochs 3
tensor_flow_ run 7a --data-dir cats_and_dogs_filtered          # downloads ImageNet weights
tensor_flow_ run 8 --save-plots plots                         # save plots instead of showing them
```

Each assignment can also be run as a module or imported:

```bash
python -m tensor_flow_.assignment_3 --epochs 8
```

```python
from tensor_flow_ import assignment_4
assignment_4.main(["--epochs", "2", "--save-plots", "plots"])
```

### Common options

| Option | Meaning |
|---|---|
| `--epochs N` | Number of training epochs (each assignment keeps its original default) |
| `--save-plots DIR` | Save every plot as a PNG in `DIR` instead of opening a window |
| `--train-csv`, `--test-csv` | Fashion-MNIST / MNIST CSV paths (assignments 2, 3, 4, 8) |
| `--csv` | IMDB CSV path (assignments 6a, 6b) |
| `--data-dir` | Image folder (assignments 5b, 7a, 7b) |
| `--weights` | Local pretrained weights file (assignments 7a, 7b); omit to download ImageNet weights |

## Datasets

The datasets are not included in the package.

- **Fashion-MNIST CSV**: `fashion-mnist_train.csv` and `fashion-mnist_test.csv`, with a `label` column
  and `pixel1` ... `pixel784` columns (available on Kaggle).
- **IMDB**: `IMDB Dataset.csv` with `review` and `sentiment` columns (Kaggle "IMDB Dataset of 50K Movie Reviews").
- **CIFAR-10 folders**: `train/<class>/` and `test/<class>/` image folders.
- **Cats vs dogs**: `cats_and_dogs_filtered/train/{cats,dogs}` and `cats_and_dogs_filtered/validation/{cats,dogs}`.

## Building and publishing

```bash
pip install build twine
python -m build                 # creates dist/*.whl and dist/*.tar.gz
twine check dist/*
twine upload dist/*             # needs a PyPI account and API token
```

To try a release first, upload to TestPyPI with `twine upload --repository testpypi dist/*`.

## License

MIT
