Metadata-Version: 2.4
Name: aimllab33
Version: 0.1.0
Summary: Complete offline Python source for 33 AI and ML lab practicals.
Keywords: artificial-intelligence,machine-learning,education,lab,offline
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Topic :: Education
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# AIMLLab

**All 33 AI and ML lab practicals, available as complete Python source—offline.**

AIMLLab is a lightweight Python library and command-line code viewer. Look up a question number, an algorithm, or a topic to print the complete, copyable solution. The installed package contains the source; it does not contact a website, download snippets, or execute a lab program when imported.

Q1–Q8 contain the existing user-input versions. Q9–Q33 retain the existing solutions, including three separate Apriori implementations. All **35 bundled source resources covering 33 questions** match their authoritative originals byte for byte. Existing source limitations are recorded in the [source review](docs/SOURCE_REVIEW.md).

> Version 0.1.0 is prepared for publication as the **`aimllab33`** distribution. Until the public release is verified, install the local wheel below. The Python import and command remain **`aimllab`**. Licensing has not yet been selected.

## Install locally

Requires **Python 3.9 or newer** on Windows, macOS, or Linux. The viewer has **no third-party runtime dependencies**.

From the project folder, install the built wheel:

```bash
python -m pip install --no-index --no-deps ./dist/aimllab33-0.1.0-py3-none-any.whl
```

Alternatively, install directly from the source folder:

```bash
python -m pip install .
```

To share a ready-to-install file, send the wheel and the [short installation instructions](docs/FRIENDS.md). Building or installing from source can require build tools or network access; an installed viewer works offline.

## Quick start

```python
import aimllab

aimllab.show(9)          # Question number, actual title, and complete source
aimllab.show("q9")       # Also accepts "Q09" and "9"
aimllab.show("knn")      # Complete Q18, Q19, Q20, and Q32 solutions
aimllab.show("pca")      # Complete Q9 and Q13 solutions
aimllab.show("kmeans")   # Complete Q25–Q28 solutions
aimllab.show("pipeline") # Complete Q33 solution
aimllab.show("compare") # All designated comparison practicals
```

`show()` prints full source, with a separate heading for each matching question. It never runs the displayed program. Topic lookups show every matching question, rather than selecting just one.

For source without any printed headings:

```python
code = aimllab.get(18)
print(code)

matches = aimllab.get_many("knn")  # Structured results for a group
```

`get()` retrieves a single question as a raw string. Use `get_many()` for a topic or group. Invalid lookups print helpful guidance; an invalid `get()` returns an empty string, and an invalid `show()` returns an empty list.

## Apriori: three complete versions

The Groceries CSV implementation is primary. Both `show(29)` and `show("apriori")` print all available variants, in this order:

| Variant | Source |
|---|---|
| `groceries` | Existing CSV-based implementation: groups grocery purchases into transactions, encodes the basket, and prints itemsets and rules |
| `basic` | Existing basic/PDF implementation with predefined transactions |
| `basic2` | Second existing basic implementation with ten predefined transactions |

```python
aimllab.show("apriori")
aimllab.show(29, variant="groceries")
aimllab.show(29, variant="basic")
aimllab.show(29, variant="basic2")

code = aimllab.get(29)                    # Primary Groceries CSV source
other_code = aimllab.get(29, variant="basic2")
```

The variants remain separate programs; the viewer does not combine their datasets or run them.

## Topic lookups

Lookups are case-insensitive and tolerate spaces, hyphens, and underscores. A question can appear in several groups.

| Topic | Questions |
|---|---|
| `astar` | 1, 3, 8 |
| `search` | 1, 2, 3, 8 |
| `greedy` | 2 |
| `csp` | 4, 5, 6 |
| `minimax` | 7 |
| `puzzle` | 5, 8 |
| `regression` | 9, 10, 11, 12, 13 |
| `pca` | 9, 13 |
| `decisiontree` | 14, 15, 16, 17, 22, 23, 32 |
| `knn` | 18, 19, 20, 32 |
| `naivebayes` | 21, 22, 32 |
| `randomforest` | 23, 24 |
| `kmeans` | 25, 26, 27, 28 |
| `apriori` | 29 |
| `ann` | 30, 31 |
| `pipeline` | 33 |
| `compare` | 9, 13, 17, 18, 19, 20, 22, 23, 28, 32 |

Additional groups include `classification`, `clustering`, `neuralnetwork`, `optimization`, and `eda`. See the [complete topic reference](docs/TOPICS.md), or run `aimllab.list_topics()` to inspect the installed registry.

| Also accepted | Canonical topic |
|---|---|
| `dt`, `decision tree`, `decision_tree` | `decisiontree` |
| `rf`, `random forest`, `random_forest` | `randomforest` |
| `nb`, `naive bayes`, `naïve bayes` | `naivebayes` |
| `k-means`, `k_means` | `kmeans` |
| `linear regression`, `lr` | `regression` |
| `neural network`, `tensorflow` | `ann` |

## Browse and search

```python
aimllab.list_questions()          # All question numbers and titles
aimllab.list_topics()             # Available topic groups
aimllab.search("classification") # Search titles, topics, and keywords
aimllab.info(9)                   # Title, algorithm, dataset, and topics
aimllab.help()                    # Usage examples
```

These helpers print readable output; the listing, search, and information helpers also return structured data. All metadata lives in a central registry; the source is stored separately as package data.

## Command-line use

```bash
aimllab show 9
aimllab show knn
aimllab show pca
aimllab show compare
aimllab show apriori
aimllab show 29 --variant groceries
aimllab show 29 --variant basic
aimllab show 29 --variant basic2
aimllab list
aimllab topics
aimllab search regression
aimllab info 29
aimllab --help
```

If your shell cannot find the `aimllab` command, use the same interpreter that installed the wheel:

```bash
python -m aimllab show knn
python -m aimllab --help
```

## Viewing code and running code

**Viewing:** Python's standard library is sufficient. Code is loaded from resources inside the installed package. No dataset, ML framework, account, website, or internet connection is required.

**Running:** Copy the requested program into a Python file or notebook, then install the libraries it imports and supply the dataset it expects. Depending on the practical, these can include pandas, NumPy, scikit-learn, Matplotlib, mlxtend, or TensorFlow. Relative CSV filenames are resolved from the working directory of the program you run. Dataset files are not supplied by the viewer.

Q1–Q8 ask for input when the copied programs are executed. The viewer itself does not prompt for city graphs, grids, boards, or other lab inputs.

Source preservation is documented in the [question inventory](docs/INVENTORY.md). Read the [source and requirements review](docs/SOURCE_REVIEW.md) for limitations or differences from the assignment; bundling a solution does not claim that every external dataset or dependency has been runtime-validated.

## Build and test

From the project folder:

```bash
python -m pip install --upgrade build
python -m build
python -m pip install --force-reinstall --no-deps ./dist/aimllab33-0.1.0-py3-none-any.whl
python -m unittest discover -s tests -v
python tools/check_distribution.py dist/aimllab33-0.1.0-py3-none-any.whl dist/aimllab33-0.1.0.tar.gz --smoke
```

The build creates a wheel and source distribution in `dist/`. The distribution checker inspects both archives; `--smoke` also installs the local wheel without an index into a fresh temporary environment outside the repository and runs the tests there. The [validation report](docs/VALIDATION.md) records completed checks. The [publishing guide](docs/PUBLISHING.md) explains clean-environment checks, metadata validation, and the separate approval needed before publication.

Optional, separate from the dependency-free viewer tests: with NumPy, pandas, scikit-learn, Matplotlib, and mlxtend installed, run `python tools/check_ml_examples.py`. This executes Q16, Q17, Q18, Q22, Q23, and Q32 using built-in datasets, plus all three Q29 variants; the Groceries CSV check uses a clearly synthetic ten-transaction fixture. It covers nine source programs, rather than all 33 practicals or every external dataset.

The [source tree](docs/STRUCTURE.md) describes the package layout. The package is a separate project from the website. Installing or importing it does not modify the website or require its deployment.
