Metadata-Version: 2.4
Name: opdl
Version: 0.2.1
Summary: Deep Learning practicals 1-9 (import name: DL): feed-forward, regularization, FixMatch, multi-task, CNN, autoencoder, RNN, recursive NN and linear models
Author: RSEMES
License: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# DL — Deep Learning Practicals 1–9 (pip package)

All nine practicals refactored into one importable, pip-installable package
named **`DL`**. After installing, you can `import DL` from any folder on any
machine and run every practical — no more `cd`-ing into folders or broken
relative CSV paths.

## Installation

From PyPI:

```powershell
pip install opdl
```

> The **install name** is `opdl` (the name `DL` was already taken on PyPI),
> but the **import name** is exactly `DL` as used throughout this README.

For local development, from this folder:

```powershell
pip install .          # normal install
# or, for development (edits take effect immediately):
pip install -e .
```

Dependencies installed automatically: **none.** This is a solo package — `pip install opdl` installs only the `DL` import package and the `dl-prac*` commands. It does **not** pull in TensorFlow, PyTorch, scikit-learn, etc.

> **Important:** Because there are zero dependencies, `pip install opdl` will succeed on a bare Python install, but individual practicals still need their heavy libraries present when you actually run them (for example TensorFlow for prac 1, 2, 4, 5, 7; PyTorch for prac 3, 6, 8, 9). Install only the ones you need, e.g.::
>
>     pip install tensorflow torch scikit-learn pandas matplotlib

Everything else stays the same: the import name is `DL`, the install name is `opdl`, and nothing runs at import time — every practical is `main()` + helper functions.

## What's inside

| Practical | Module                  | Command     | Dataset                                      |
|-----------|-------------------------|-------------|----------------------------------------------|
| 1         | `DL.prac1_feedforward`  | `dl-prac1`  | Employee.csv (bundled)                       |
| 2         | `DL.prac2_regularization`| `dl-prac2` | StudentsPerformance.csv (bundled)            |
| 3         | `DL.prac3_fixmatch`     | `dl-prac3`  | semi_supervised_dataset.csv (bundled)        |
| 4         | `DL.prac4_multitask`    | `dl-prac4`  | ames_mutagenicity_data.csv (bundled, ~90 MB) |
| 5         | `DL.prac5_cnn`          | `dl-prac5`  | **SVHN** — download separately (see below)   |
| 6         | `DL.prac6_autoencoder`  | `dl-prac6`  | **CIFAR-10 pickles** — download separately   |
| 7         | `DL.prac7_rnn`          | `dl-prac7`  | IMDB — auto-downloaded by Keras              |
| 8         | `DL.prac8_recursive`    | `dl-prac8`  | none (synthetic tree demo)                   |
| 9         | `DL.prac9_linear`       | `dl-prac9`  | none (sklearn synthetic blobs)               |

## Usage

### As commands

```powershell
dl-prac1
dl-prac8
dl-prac5 --train-dir C:\data\hoousenumbers\train --test-dir C:\data\hoousenumbers\test
dl-prac6 --data-dir C:\data\cifar-10-batches-py
dl-prac7 --epochs 2 --max-samples 5000
```

### As a library

```python
from DL import prac8_recursive
model, probs = prac8_recursive.main()

from DL import prac2_regularization
cfg = prac2_regularization.Config(epochs=20)   # tweak any hyper-parameter
prac2_regularization.main(cfg=cfg)

# Use the bundled datasets with your own code too:
from DL import data_path
import pandas as pd
df = pd.read_csv(data_path("Employee.csv"))
```

Every `main()` also accepts your own data / output paths, e.g.
`prac1_feedforward.main(csv_path="my.csv")`,
`prac3_fixmatch.main(data_path="my_data.csv", output_dir="out")`.

## External datasets (prac 5 & 6)

These are too large to bundle in a wheel:

- **SVHN (prac 5):** get the HDF5-format SVHN (`digitStruct.mat` + PNGs) and
  pass `--train-dir` / `--test-dir`.
- **CIFAR-10 (prac 6):** download
  <https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz>, extract, and pass
  `--data-dir <path to cifar-10-batches-py>`.

Both raise a clear `FileNotFoundError` with instructions if the data is missing.

## Notes on the refactor

- Nothing runs at import time; every practical is `main()` + helper functions.
- Dataset paths are resolved with `importlib`-friendly helpers
  (`DL.data_path(...)`) instead of `__file__`/cwd tricks, so they work in any
  installed location (including zipped wheels).
- Original scripts are untouched in their original folders; the package lives
  under `src/DL/`.
- Practical 3's dataset was missing from the original folder, so a
  replacement sample dataset (10 labeled + 10 unlabeled movie reviews) is
  bundled as `semi_supervised_dataset.csv`. Drop in your own CSV with the same
  `id,text,label` schema to use the real one.
