Metadata-Version: 2.4
Name: seaborn-lite
Version: 0.1.1
Summary: A tiny matplotlib-only seaborn subset plus the DWM practical-exam algorithms, from scratch.
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: matplotlib>=3.7
Dynamic: license-file

# seaborn-lite

A tiny, matplotlib-only subset of seaborn **plus** every algorithm from the
DWM practical exam and every experiment write-up, packaged for direct use.

No seaborn, no scikit-learn, no scipy — just `numpy`, `pandas` and `matplotlib`.

## Install

```bash
pip install .
```

That installs the distribution `seaborn-lite` and the import package
`seaborn_lite`, bundles the 14 exam datasets, and adds the `seaborn-lite`
command. To publish it so `pip install seaborn-lite` works from anywhere, build
and upload it with `python -m build` + `twine upload dist/*`.

## Print an experiment write-up

Every experiment `.txt` is bundled. One function per experiment prints it
verbatim and returns the same text:

```python
import seaborn_lite as snsl

snsl.apriori()      # prints 05_APRIORI_FREQUENT_PATTERNS.txt
snsl.sql()          # prints 01_SQL_EXPERIMENTS.txt
snsl.list()         # shows every available function
```

| Function | Prints |
| :--- | :--- |
| `sql()` | `01_SQL_EXPERIMENTS.txt` |
| `star_schema()` | `02_STAR_SCHEMA_AND_15_QUERIES.txt` |
| `olap()` | `03_OLAP_OPERATIONS.txt` |
| `preprocessing()`, `data_preprocessing()` | `04_DATA_PREPROCESSING_AND_VISUALISATION.txt` |
| `apriori()`, `appriori()` | `05_APRIORI_FREQUENT_PATTERNS.txt` |
| `kmeans()`, `kmedoids()` | `06_KMEANS_AND_KMEDOIDS.txt` |
| `hierarchical()`, `hierarchical_clustering()` | `07_HIERARCHICAL_CLUSTERING.txt` |
| `naive_bayes()`, `categorical_naive_bayes()`, `gaussian_naive_bayes()` | `08_NAIVE_BAYES.txt` |
| `pagerank()`, `hits()` | `09_PAGERANK_AND_HITS.txt` |
| `all_experiments()` | `DWM_ALL_EXPERIMENTS_ONE_FILE.txt` |

`snsl.list()` prints this table with the exact function names and file names.
The algorithm implementations live under `seaborn_lite.dwm`, so
`snsl.kmeans()` prints the write-up while `seaborn_lite.dwm.kmeans(X, k=3)`
does the clustering.

## Plotting

```python
import seaborn_lite as sns
from seaborn_lite import datasets

df = datasets.load("customer_churn_raw")
sns.set_theme()
sns.histplot(df, x="Age", kde=True)
sns.countplot(df, x="Contract_Type")
sns.heatmap(df.select_dtypes("number").corr(), annot=True)
```

Supported: `histplot`, `countplot`, `barplot`, `boxplot`, `scatterplot`,
`heatmap`, `pairplot`, `set_theme`. Same `data=` / `x=` / `y=` calling style as
seaborn; plot functions return the matplotlib `Axes` (`pairplot` returns an
object with `.fig` and `.savefig`; `set_theme` returns nothing). `pairplot`
plots numeric columns only.

## Algorithms

```python
from seaborn_lite import datasets
from seaborn_lite.dwm import kmeans
from seaborn_lite.dwm.itemsets import apriori, transactions_from_dataframe

X = datasets.load("mall_customers").select_dtypes("number").to_numpy()
result = kmeans(X, k=3)
print(result.centroids, result.wcss)

tx = transactions_from_dataframe(datasets.load("transactions_list"))
frequent = apriori(tx, min_support=0.3)
```

### API by experiment

| Experiment | Import | Main callables |
| :--- | :--- | :--- |
| 3 · OLAP | `from seaborn_lite.dwm import rollup, drilldown, slice_cube, dice_cube, pivot` | `rollup(df, dim, measure)`, `drilldown`, `slice_cube`, `dice_cube`, `pivot` |
| 4 · Explore | `from seaborn_lite.dwm import explore` | `explore(df) -> dict` |
| 4 · Clean | `from seaborn_lite.dwm import clean_dataframe` | `clean_dataframe(df, rename=...)` |
| 4 · Preprocess | `from seaborn_lite.dwm import discretize, label_encode, one_hot_encode, minmax_scale, zscore_scale, train_test_split` | all six helpers |
| 4 · Visualise | `from seaborn_lite.dwm import plot_all` | `plot_all(df, out_dir)` |
| 4 · Pivot | `from seaborn_lite.dwm import group_summary, multi_agg, pivot_table` | `group_summary`, `multi_agg`, `pivot_table` |
| 5 · Apriori | `from seaborn_lite.dwm import apriori, association_rules` | `apriori(transactions, min_support)`, `association_rules(frequent, transactions, min_confidence)` |
| 6 · K-Means | `from seaborn_lite.dwm import kmeans, elbow` | `kmeans(X, k) -> KMeansResult`, `elbow(X, k_max)` |
| 6 · K-Medoids | `from seaborn_lite.dwm import kmedoids` | `kmedoids(X, k) -> KMedoidsResult` |
| 7 · Hierarchical | `from seaborn_lite.dwm import agglomerative, silhouette_score, plot_dendrogram` | four linkages (`single`/`complete`/`average`/`ward`), `scale=True` for StandardScaler behaviour |
| 8 · Naive Bayes | `from seaborn_lite.dwm import CategoricalNB, GaussianNB` | scikit-learn-shaped `fit` / `predict` / `predict_proba` |
| 9 · PageRank | `from seaborn_lite.dwm import pagerank, hits` | `pagerank(graph) -> dict`, `hits(graph) -> (hubs, authorities)` |

## Datasets

```python
from seaborn_lite import datasets

datasets.available()          # 14 names
datasets.load("play_tennis")  # DataFrame
datasets.path("play_tennis")  # Path to the bundled CSV
```

## CLI

```bash
seaborn-lite list
seaborn-lite datasets
seaborn-lite run kmeans
seaborn-lite run visualise --out ./plots
seaborn-lite run apriori --data my_baskets.csv
```

Demos: `apriori`, `kmeans`, `kmedoids`, `hierarchical`, `nb-categorical`,
`nb-gaussian`, `pagerank`, `hits`, `olap`, `explore`, `clean`, `preprocess`,
`pivot`, `visualise`.

## Layout

```text
seaborn-lite/
├── seaborn_lite/
│   ├── plotting.py        # the seaborn subset
│   ├── experiments/       # the 10 bundled .txt write-ups + printers/list()
│   ├── datasets/          # bundled CSVs + loaders
│   ├── demos.py           # what the CLI runs
│   ├── cli.py
│   └── dwm/               # the exam algorithms
├── tests/selfcheck.py     # assert-based, no test framework
├── pyproject.toml
└── DWM_PRACTICAL_EXAM/    # original exam submission, left untouched
```

## Verify

```bash
python tests/selfcheck.py
```

This loads every dataset, checks known results (17 Apriori itemsets, Ward
silhouette 0.2352, 13/14 Tennis accuracy, PageRank ranking), writes all eight
plots, and runs every CLI demo.
