seeplot 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
seeplot-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: seeplot
3
+ Version: 0.1.0
4
+ Summary: Four ML lab pipeline notebooks with an interactive picker
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+
8
+ # seeplot
9
+
10
+ Four ML lab pipeline notebooks (spam classification, breast cancer ensembles, loan regression, K-Means).
11
+
12
+ ```bash
13
+ pip install seeplot && seeplot
14
+ ```
15
+
16
+ Pick with up/down and space, press enter (nothing selected = all 4). Notebooks are saved in the current folder.
17
+
18
+ Without the picker: `seeplot init spam loan` (keys: spam, cancer, loan, kmeans) or `seeplot init --all`.
@@ -0,0 +1,11 @@
1
+ # seeplot
2
+
3
+ Four ML lab pipeline notebooks (spam classification, breast cancer ensembles, loan regression, K-Means).
4
+
5
+ ```bash
6
+ pip install seeplot && seeplot
7
+ ```
8
+
9
+ Pick with up/down and space, press enter (nothing selected = all 4). Notebooks are saved in the current folder.
10
+
11
+ Without the picker: `seeplot init spam loan` (keys: spam, cancer, loan, kmeans) or `seeplot init --all`.
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "seeplot"
7
+ version = "0.1.0"
8
+ description = "Four ML lab pipeline notebooks with an interactive picker"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ dependencies = []
12
+
13
+ [project.scripts]
14
+ seeplot = "seeplot.cli:main"
15
+
16
+ [tool.setuptools.packages.find]
17
+ where = ["src"]
18
+
19
+ [tool.setuptools.package-data]
20
+ seeplot = ["content/*.ipynb"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,64 @@
1
+ import argparse, curses, shutil, sys
2
+ from importlib.resources import files
3
+ from pathlib import Path
4
+
5
+ ITEMS = { # key: (notebook, description)
6
+ "spam": ("01_Spambase_Classification.ipynb", "Spam vs ham: Decision Tree, KNN, SVM"),
7
+ "cancer": ("02_BreastCancer_Classification.ipynb", "Breast cancer: Decision Tree, Random Forest, AdaBoost, Gradient Boosting, XGBoost"),
8
+ "loan": ("03_LoanAmount_Regression.ipynb", "Loan regression: Linear, Ridge, Lasso, ElasticNet, Random Forest"),
9
+ "kmeans": ("04_KMeans_Clustering.ipynb", "K-Means clustering + PCA"),
10
+ }
11
+
12
+
13
+ def pick():
14
+ keys = list(ITEMS)
15
+
16
+ def ui(scr):
17
+ curses.curs_set(0)
18
+ cur, on = 0, set()
19
+ while True:
20
+ scr.erase()
21
+ scr.addstr(0, 0, "seeplot up/down move | space select | enter download (none selected = all 4) | q quit")
22
+ for i, k in enumerate(keys):
23
+ mark = "[x]" if k in on else "[ ]"
24
+ line = f" {mark} {ITEMS[k][0]:<40} {ITEMS[k][1]}"
25
+ scr.addstr(2 + i, 0, line[: curses.COLS - 1], curses.A_REVERSE if i == cur else 0)
26
+ scr.refresh()
27
+ c = scr.getch()
28
+ if c in (curses.KEY_UP, ord("k")): cur = (cur - 1) % len(keys)
29
+ elif c in (curses.KEY_DOWN, ord("j")): cur = (cur + 1) % len(keys)
30
+ elif c == ord(" "): on ^= {keys[cur]}
31
+ elif c == ord("a"): on = set(keys) if len(on) < len(keys) else set()
32
+ elif c in (10, 13, curses.KEY_ENTER): return [k for k in keys if k in on] or keys
33
+ elif c in (ord("q"), 27): return []
34
+
35
+ return curses.wrapper(ui)
36
+
37
+
38
+ def download(keys, dest):
39
+ src, dest = files("seeplot") / "content", Path(dest)
40
+ dest.mkdir(parents=True, exist_ok=True)
41
+ for k in keys:
42
+ shutil.copy(src / ITEMS[k][0], dest / ITEMS[k][0])
43
+ print(" added", ITEMS[k][0])
44
+ print("\nSaved in", dest.resolve())
45
+
46
+
47
+ def main():
48
+ ap = argparse.ArgumentParser(prog="seeplot", description="Pick ML lab notebooks to download.")
49
+ ap.add_argument("cmd", nargs="?", default="init", choices=["init", "list"])
50
+ ap.add_argument("names", nargs="*", help="spam cancer loan kmeans (omit to pick interactively)")
51
+ ap.add_argument("--all", action="store_true", help="download all 4")
52
+ ap.add_argument("-d", "--dest", default=".", help="target folder (default: current folder)")
53
+ a = ap.parse_args()
54
+ if a.cmd == "list":
55
+ for k, v in ITEMS.items(): print(f"{k:8s}{v[0]:42s}{v[1]}")
56
+ return
57
+ keys = list(ITEMS) if a.all else a.names
58
+ bad = [k for k in keys if k not in ITEMS]
59
+ if bad: sys.exit(f"unknown: {bad}. choose from {list(ITEMS)}")
60
+ if not keys:
61
+ if not sys.stdin.isatty(): sys.exit("no terminal: pass names, e.g. ml-lab-prep init spam loan")
62
+ keys = pick()
63
+ if not keys: sys.exit("nothing selected")
64
+ download(keys, a.dest)