plainml 0.1.0__tar.gz → 0.1.2__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.
- {plainml-0.1.0 → plainml-0.1.2}/PKG-INFO +37 -17
- {plainml-0.1.0 → plainml-0.1.2}/README.md +34 -15
- {plainml-0.1.0 → plainml-0.1.2}/plainml/__init__.py +8 -3
- plainml-0.1.2/plainml/_wheel.py +48 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/cli.py +22 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/console.py +5 -0
- plainml-0.1.2/plainml/datasets/__init__.py +134 -0
- plainml-0.1.2/plainml/datasets/churn.csv +1501 -0
- plainml-0.1.2/plainml/datasets/customers.csv +601 -0
- plainml-0.1.2/plainml/datasets/daily_sales.csv +913 -0
- plainml-0.1.2/plainml/datasets/house_prices.csv +1201 -0
- plainml-0.1.2/plainml/datasets/store_sales.csv +1681 -0
- plainml-0.1.2/plainml/datasets/transactions.csv +3001 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/deploy.py +2 -23
- {plainml-0.1.0 → plainml-0.1.2}/plainml/training.py +2 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/tuning.py +13 -1
- plainml-0.1.2/plainml/web/browser.py +192 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/web/jobs.py +51 -26
- {plainml-0.1.0 → plainml-0.1.2}/plainml/web/server.py +147 -75
- {plainml-0.1.0 → plainml-0.1.2}/plainml/web/static/app.css +9 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/web/static/app.js +180 -22
- plainml-0.1.2/plainml/web/static/worker.js +108 -0
- plainml-0.1.2/plainml/web/static_site.py +81 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml.egg-info/PKG-INFO +37 -17
- {plainml-0.1.0 → plainml-0.1.2}/plainml.egg-info/SOURCES.txt +13 -0
- {plainml-0.1.0 → plainml-0.1.2}/pyproject.toml +3 -2
- plainml-0.1.2/tests/test_browser.py +110 -0
- plainml-0.1.2/tests/test_datasets.py +50 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_web.py +12 -0
- {plainml-0.1.0 → plainml-0.1.2}/LICENSE +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/__main__.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/anomaly.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/card.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/cleaning.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/clustering.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/config.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/deep.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/drift.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/errors.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/evaluation.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/explaining.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/export.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/forecasting.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/importance.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/io.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/metrics.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/predicting.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/preprocessing.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/profiling.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/py.typed +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/registry.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/report.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/runs.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/schema.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/selection.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/serve.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/tasks.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/tracking.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/web/__init__.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/web/static/index.html +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml/wizard.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml.egg-info/dependency_links.txt +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml.egg-info/entry_points.txt +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml.egg-info/requires.txt +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/plainml.egg-info/top_level.txt +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/setup.cfg +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_basics.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_cli.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_commands.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_deploy.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_drift.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_forecasting.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_importance.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_models.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_regressions.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_training.py +0 -0
- {plainml-0.1.0 → plainml-0.1.2}/tests/test_wizard.py +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plainml
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Machine learning in plain English: from a spreadsheet to a trained, explained, deployable model in one command.
|
|
5
5
|
Author: Pranay Obla
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://
|
|
7
|
+
Project-URL: Homepage, https://plainml-tpua.vercel.app/
|
|
8
|
+
Project-URL: Documentation, https://plainml-tpua.vercel.app/docs/
|
|
8
9
|
Project-URL: Repository, https://github.com/pranay-obla/plainml
|
|
9
10
|
Project-URL: Issues, https://github.com/pranay-obla/plainml/issues
|
|
10
11
|
Project-URL: Changelog, https://github.com/pranay-obla/plainml/blob/main/CHANGELOG.md
|
|
@@ -90,6 +91,12 @@ Dynamic: license-file
|
|
|
90
91
|
From a spreadsheet to a trained, explained, deployable model in one command, or one click.
|
|
91
92
|
</p>
|
|
92
93
|
|
|
94
|
+
<p align="center">
|
|
95
|
+
<a href="https://plainml-tpua.vercel.app"><b>Try it in your browser</b></a> ·
|
|
96
|
+
<a href="https://plainml-tpua.vercel.app/docs/">Documentation</a> ·
|
|
97
|
+
<a href="https://pypi.org/project/plainml/">PyPI</a>
|
|
98
|
+
</p>
|
|
99
|
+
|
|
93
100
|
<p align="center">
|
|
94
101
|
<a href="https://pypi.org/project/plainml/"><img src="https://img.shields.io/pypi/v/plainml?color=blue&label=pypi" alt="PyPI version"></a>
|
|
95
102
|
<a href="https://pypi.org/project/plainml/"><img src="https://img.shields.io/pypi/pyversions/plainml" alt="Python versions"></a>
|
|
@@ -164,7 +171,8 @@ pip install "plainml[all]" # or pick: pip install "plainml[web,boost]"
|
|
|
164
171
|
|
|
165
172
|
## 30-second quickstart
|
|
166
173
|
|
|
167
|
-
The repository ships with example datasets in [`examples/`](https://github.com/pranay-obla/plainml/tree/main/examples)
|
|
174
|
+
The repository ships with example datasets in [`examples/`](https://github.com/pranay-obla/plainml/tree/main/examples)
|
|
175
|
+
(installed with plainml too: `plainml.datasets.path("churn")` gives a copy's path):
|
|
168
176
|
|
|
169
177
|
```bash
|
|
170
178
|
plainml train examples/churn.csv --target churned
|
|
@@ -187,7 +195,8 @@ pip install "plainml[web]"
|
|
|
187
195
|
plainml web
|
|
188
196
|
```
|
|
189
197
|
|
|
190
|
-
1. **Upload.** Drag in a file and see every column's type and a
|
|
198
|
+
1. **Upload.** Drag in a file, or click one of six example datasets, and see every column's type and a
|
|
199
|
+
preview of the rows. An example also fills in the task and settings that suit it.
|
|
191
200
|
2. **Pick a task.** Predict a column, forecast, find groups, find unusual rows, rank columns, check drift,
|
|
192
201
|
profile or clean. The main options are up front; the rest are under *More options*.
|
|
193
202
|
3. **Watch it run.** A progress bar and a live log show each step.
|
|
@@ -199,9 +208,16 @@ plainml web
|
|
|
199
208
|
|
|
200
209
|
The **Runs** page lists everything you've run (from the website or the command line), and **Predict** uses
|
|
201
210
|
any saved model on a new upload. The site works in light and dark mode and on phones. It only listens on
|
|
202
|
-
your machine; to share it on a network, add a token: `plainml web --host 0.0.0.0 --token change-me`.
|
|
203
|
-
|
|
204
|
-
|
|
211
|
+
your machine; to share it on a network, add a token: `plainml web --host 0.0.0.0 --token change-me`.
|
|
212
|
+
|
|
213
|
+
**Try it now at [plainml-tpua.vercel.app](https://plainml-tpua.vercel.app)**, with nothing to install: click an example
|
|
214
|
+
dataset and press Run.
|
|
215
|
+
|
|
216
|
+
**No server needed:** `plainml web --export site` writes the same website as static files that run
|
|
217
|
+
plainml inside the visitor's browser. Their data never leaves their computer, and the site can be hosted
|
|
218
|
+
for free on Vercel, GitHub Pages or a Hugging Face Static Space. See the
|
|
219
|
+
[hosting guide](https://plainml-tpua.vercel.app/docs/hosting/) and the
|
|
220
|
+
[website guide](https://plainml-tpua.vercel.app/docs/website/).
|
|
205
221
|
|
|
206
222
|
## What it can do
|
|
207
223
|
|
|
@@ -292,7 +308,7 @@ meant to travel with the model.
|
|
|
292
308
|
| | `plainml export MODEL` | ONNX (for C#, Java, JavaScript, C++…) or MLflow |
|
|
293
309
|
| **Housekeeping** | `plainml runs` / `compare` / `models` / `init` | List, compare and prune runs; list models; write a config |
|
|
294
310
|
|
|
295
|
-
Every command has examples in `plainml COMMAND --help`, and the [command reference](https://
|
|
311
|
+
Every command has examples in `plainml COMMAND --help`, and the [command reference](https://plainml-tpua.vercel.app/docs/commands/) lists
|
|
296
312
|
every option.
|
|
297
313
|
|
|
298
314
|
## Examples
|
|
@@ -377,10 +393,12 @@ build doesn't need PyPI.
|
|
|
377
393
|
JavaScript or C++. `--format mlflow` saves an MLflow model, and `plainml train --mlflow` logs runs to your
|
|
378
394
|
MLflow tracking server.
|
|
379
395
|
|
|
380
|
-
**Hosting.** The [hosting guide](https://
|
|
381
|
-
putting the website online
|
|
382
|
-
|
|
383
|
-
|
|
396
|
+
**Hosting.** The [hosting guide](https://plainml-tpua.vercel.app/docs/hosting/) covers
|
|
397
|
+
putting the website online:
|
|
398
|
+
- **In the browser, free:** on Vercel, next to the docs (`vercel.json` builds both), or on a Hugging Face
|
|
399
|
+
Static Space.
|
|
400
|
+
- **On a server:** on any container host, using the Dockerfile in
|
|
401
|
+
[`hosting/docker/`](https://github.com/pranay-obla/plainml/tree/main/hosting/docker).
|
|
384
402
|
|
|
385
403
|
## Trust and privacy
|
|
386
404
|
|
|
@@ -424,7 +442,7 @@ model = joblib.load("runs/20260925-125240_churn/model.joblib")
|
|
|
424
442
|
model.predict(pd.read_csv("new_customers.csv"))
|
|
425
443
|
```
|
|
426
444
|
|
|
427
|
-
See the [Python API guide](https://
|
|
445
|
+
See the [Python API guide](https://plainml-tpua.vercel.app/docs/python-api/).
|
|
428
446
|
|
|
429
447
|
## Reproducible runs
|
|
430
448
|
|
|
@@ -457,7 +475,7 @@ or start your own commented config with `plainml init`.
|
|
|
457
475
|
- the report and model card
|
|
458
476
|
- a summary of the training data, for drift checks
|
|
459
477
|
|
|
460
|
-
More detail, including forecasting, importance and drift, is in [
|
|
478
|
+
More detail, including forecasting, importance and drift, is in [How it works](https://plainml-tpua.vercel.app/docs/how-it-works/).
|
|
461
479
|
|
|
462
480
|
## How plainml compares
|
|
463
481
|
|
|
@@ -514,9 +532,11 @@ pytest
|
|
|
514
532
|
|
|
515
533
|
</details>
|
|
516
534
|
|
|
517
|
-
CI runs the tests on Python 3.10 to 3.14
|
|
518
|
-
included), against the oldest supported library versions, and weekly
|
|
519
|
-
library update can't silently break plainml.
|
|
535
|
+
CI runs the tests on every Python from 3.10 to 3.14 on Linux, macOS and Windows. It also tests with
|
|
536
|
+
every optional extra (PyTorch included), against the oldest supported library versions, and weekly
|
|
537
|
+
against the newest releases, so a library update can't silently break plainml.
|
|
538
|
+
|
|
539
|
+
Publishing a GitHub release sends the package to PyPI (see
|
|
520
540
|
[RELEASING.md](https://github.com/pranay-obla/plainml/blob/main/RELEASING.md)), and the documentation in
|
|
521
541
|
`docs/` can be hosted on Vercel or GitHub Pages.
|
|
522
542
|
|
|
@@ -5,6 +5,12 @@
|
|
|
5
5
|
From a spreadsheet to a trained, explained, deployable model in one command, or one click.
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
|
+
<p align="center">
|
|
9
|
+
<a href="https://plainml-tpua.vercel.app"><b>Try it in your browser</b></a> ·
|
|
10
|
+
<a href="https://plainml-tpua.vercel.app/docs/">Documentation</a> ·
|
|
11
|
+
<a href="https://pypi.org/project/plainml/">PyPI</a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
8
14
|
<p align="center">
|
|
9
15
|
<a href="https://pypi.org/project/plainml/"><img src="https://img.shields.io/pypi/v/plainml?color=blue&label=pypi" alt="PyPI version"></a>
|
|
10
16
|
<a href="https://pypi.org/project/plainml/"><img src="https://img.shields.io/pypi/pyversions/plainml" alt="Python versions"></a>
|
|
@@ -79,7 +85,8 @@ pip install "plainml[all]" # or pick: pip install "plainml[web,boost]"
|
|
|
79
85
|
|
|
80
86
|
## 30-second quickstart
|
|
81
87
|
|
|
82
|
-
The repository ships with example datasets in [`examples/`](https://github.com/pranay-obla/plainml/tree/main/examples)
|
|
88
|
+
The repository ships with example datasets in [`examples/`](https://github.com/pranay-obla/plainml/tree/main/examples)
|
|
89
|
+
(installed with plainml too: `plainml.datasets.path("churn")` gives a copy's path):
|
|
83
90
|
|
|
84
91
|
```bash
|
|
85
92
|
plainml train examples/churn.csv --target churned
|
|
@@ -102,7 +109,8 @@ pip install "plainml[web]"
|
|
|
102
109
|
plainml web
|
|
103
110
|
```
|
|
104
111
|
|
|
105
|
-
1. **Upload.** Drag in a file and see every column's type and a
|
|
112
|
+
1. **Upload.** Drag in a file, or click one of six example datasets, and see every column's type and a
|
|
113
|
+
preview of the rows. An example also fills in the task and settings that suit it.
|
|
106
114
|
2. **Pick a task.** Predict a column, forecast, find groups, find unusual rows, rank columns, check drift,
|
|
107
115
|
profile or clean. The main options are up front; the rest are under *More options*.
|
|
108
116
|
3. **Watch it run.** A progress bar and a live log show each step.
|
|
@@ -114,9 +122,16 @@ plainml web
|
|
|
114
122
|
|
|
115
123
|
The **Runs** page lists everything you've run (from the website or the command line), and **Predict** uses
|
|
116
124
|
any saved model on a new upload. The site works in light and dark mode and on phones. It only listens on
|
|
117
|
-
your machine; to share it on a network, add a token: `plainml web --host 0.0.0.0 --token change-me`.
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
your machine; to share it on a network, add a token: `plainml web --host 0.0.0.0 --token change-me`.
|
|
126
|
+
|
|
127
|
+
**Try it now at [plainml-tpua.vercel.app](https://plainml-tpua.vercel.app)**, with nothing to install: click an example
|
|
128
|
+
dataset and press Run.
|
|
129
|
+
|
|
130
|
+
**No server needed:** `plainml web --export site` writes the same website as static files that run
|
|
131
|
+
plainml inside the visitor's browser. Their data never leaves their computer, and the site can be hosted
|
|
132
|
+
for free on Vercel, GitHub Pages or a Hugging Face Static Space. See the
|
|
133
|
+
[hosting guide](https://plainml-tpua.vercel.app/docs/hosting/) and the
|
|
134
|
+
[website guide](https://plainml-tpua.vercel.app/docs/website/).
|
|
120
135
|
|
|
121
136
|
## What it can do
|
|
122
137
|
|
|
@@ -207,7 +222,7 @@ meant to travel with the model.
|
|
|
207
222
|
| | `plainml export MODEL` | ONNX (for C#, Java, JavaScript, C++…) or MLflow |
|
|
208
223
|
| **Housekeeping** | `plainml runs` / `compare` / `models` / `init` | List, compare and prune runs; list models; write a config |
|
|
209
224
|
|
|
210
|
-
Every command has examples in `plainml COMMAND --help`, and the [command reference](https://
|
|
225
|
+
Every command has examples in `plainml COMMAND --help`, and the [command reference](https://plainml-tpua.vercel.app/docs/commands/) lists
|
|
211
226
|
every option.
|
|
212
227
|
|
|
213
228
|
## Examples
|
|
@@ -292,10 +307,12 @@ build doesn't need PyPI.
|
|
|
292
307
|
JavaScript or C++. `--format mlflow` saves an MLflow model, and `plainml train --mlflow` logs runs to your
|
|
293
308
|
MLflow tracking server.
|
|
294
309
|
|
|
295
|
-
**Hosting.** The [hosting guide](https://
|
|
296
|
-
putting the website online
|
|
297
|
-
|
|
298
|
-
|
|
310
|
+
**Hosting.** The [hosting guide](https://plainml-tpua.vercel.app/docs/hosting/) covers
|
|
311
|
+
putting the website online:
|
|
312
|
+
- **In the browser, free:** on Vercel, next to the docs (`vercel.json` builds both), or on a Hugging Face
|
|
313
|
+
Static Space.
|
|
314
|
+
- **On a server:** on any container host, using the Dockerfile in
|
|
315
|
+
[`hosting/docker/`](https://github.com/pranay-obla/plainml/tree/main/hosting/docker).
|
|
299
316
|
|
|
300
317
|
## Trust and privacy
|
|
301
318
|
|
|
@@ -339,7 +356,7 @@ model = joblib.load("runs/20260925-125240_churn/model.joblib")
|
|
|
339
356
|
model.predict(pd.read_csv("new_customers.csv"))
|
|
340
357
|
```
|
|
341
358
|
|
|
342
|
-
See the [Python API guide](https://
|
|
359
|
+
See the [Python API guide](https://plainml-tpua.vercel.app/docs/python-api/).
|
|
343
360
|
|
|
344
361
|
## Reproducible runs
|
|
345
362
|
|
|
@@ -372,7 +389,7 @@ or start your own commented config with `plainml init`.
|
|
|
372
389
|
- the report and model card
|
|
373
390
|
- a summary of the training data, for drift checks
|
|
374
391
|
|
|
375
|
-
More detail, including forecasting, importance and drift, is in [
|
|
392
|
+
More detail, including forecasting, importance and drift, is in [How it works](https://plainml-tpua.vercel.app/docs/how-it-works/).
|
|
376
393
|
|
|
377
394
|
## How plainml compares
|
|
378
395
|
|
|
@@ -429,9 +446,11 @@ pytest
|
|
|
429
446
|
|
|
430
447
|
</details>
|
|
431
448
|
|
|
432
|
-
CI runs the tests on Python 3.10 to 3.14
|
|
433
|
-
included), against the oldest supported library versions, and weekly
|
|
434
|
-
library update can't silently break plainml.
|
|
449
|
+
CI runs the tests on every Python from 3.10 to 3.14 on Linux, macOS and Windows. It also tests with
|
|
450
|
+
every optional extra (PyTorch included), against the oldest supported library versions, and weekly
|
|
451
|
+
against the newest releases, so a library update can't silently break plainml.
|
|
452
|
+
|
|
453
|
+
Publishing a GitHub release sends the package to PyPI (see
|
|
435
454
|
[RELEASING.md](https://github.com/pranay-obla/plainml/blob/main/RELEASING.md)), and the documentation in
|
|
436
455
|
`docs/` can be hosted on Vercel or GitHub Pages.
|
|
437
456
|
|
|
@@ -15,7 +15,7 @@ from __future__ import annotations
|
|
|
15
15
|
|
|
16
16
|
from typing import TYPE_CHECKING, Any
|
|
17
17
|
|
|
18
|
-
__version__ = "0.1.
|
|
18
|
+
__version__ = "0.1.2"
|
|
19
19
|
|
|
20
20
|
# Public API, imported lazily so `plainml --help` doesn't pay for importing scikit-learn.
|
|
21
21
|
_API = {
|
|
@@ -40,19 +40,24 @@ _API = {
|
|
|
40
40
|
"PlainMLError": "plainml.errors",
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
_MODULES = ("datasets",) # submodules reachable as plainml.<name>
|
|
44
|
+
|
|
45
|
+
__all__ = ["__version__", *_API, *_MODULES]
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
def __getattr__(name: str) -> Any:
|
|
47
|
-
if name in _API:
|
|
49
|
+
if name in _API or name in _MODULES:
|
|
48
50
|
import importlib
|
|
49
51
|
|
|
52
|
+
if name in _MODULES:
|
|
53
|
+
return importlib.import_module(f"plainml.{name}")
|
|
50
54
|
module = importlib.import_module(_API[name])
|
|
51
55
|
return getattr(module, name)
|
|
52
56
|
raise AttributeError(f"module 'plainml' has no attribute {name!r}")
|
|
53
57
|
|
|
54
58
|
|
|
55
59
|
if TYPE_CHECKING: # pragma: no cover
|
|
60
|
+
from plainml import datasets
|
|
56
61
|
from plainml.anomaly import detect_anomalies
|
|
57
62
|
from plainml.cleaning import clean
|
|
58
63
|
from plainml.clustering import cluster
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Building plainml's own wheel from a source checkout (for `deploy` and `web --export`).
|
|
2
|
+
|
|
3
|
+
Standard library only, so it also works where plainml's dependencies aren't installed
|
|
4
|
+
(for example Vercel's build step).
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import shutil
|
|
10
|
+
import subprocess
|
|
11
|
+
import sys
|
|
12
|
+
import tempfile
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def checkout_root() -> Path | None:
|
|
17
|
+
"""The source checkout this plainml runs from, or None when it's installed from PyPI."""
|
|
18
|
+
root = Path(__file__).resolve().parents[1]
|
|
19
|
+
return root if (root / "pyproject.toml").is_file() and (root / "plainml").is_dir() else None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def build_wheel(source: Path, into: Path) -> Path | None:
|
|
23
|
+
"""Build plainml's wheel from a clean copy of ``source`` into ``into``. None if it fails.
|
|
24
|
+
|
|
25
|
+
Building in place would leave ``build/`` and ``*.egg-info`` folders in the source tree.
|
|
26
|
+
"""
|
|
27
|
+
into.mkdir(parents=True, exist_ok=True)
|
|
28
|
+
before = set(into.glob("plainml-*.whl"))
|
|
29
|
+
with tempfile.TemporaryDirectory(prefix="plainml-wheel-") as scratch:
|
|
30
|
+
copy = Path(scratch) / "src"
|
|
31
|
+
copy.mkdir()
|
|
32
|
+
for name in ("pyproject.toml", "README.md", "LICENSE"):
|
|
33
|
+
if (source / name).is_file():
|
|
34
|
+
shutil.copy2(source / name, copy / name)
|
|
35
|
+
shutil.copytree(
|
|
36
|
+
source / "plainml",
|
|
37
|
+
copy / "plainml",
|
|
38
|
+
ignore=shutil.ignore_patterns("__pycache__", "*.pyc"),
|
|
39
|
+
)
|
|
40
|
+
built = subprocess.run(
|
|
41
|
+
[sys.executable, "-m", "pip", "wheel", "--no-deps", "-q", "-w", str(into), str(copy)],
|
|
42
|
+
capture_output=True,
|
|
43
|
+
text=True,
|
|
44
|
+
)
|
|
45
|
+
if built.returncode != 0:
|
|
46
|
+
return None
|
|
47
|
+
new = sorted(set(into.glob("plainml-*.whl")) - before) or sorted(into.glob("plainml-*.whl"))
|
|
48
|
+
return new[-1] if new else None
|
|
@@ -1264,6 +1264,13 @@ def export(model: str, fmt: str, output: str | None, runs_dir: str) -> None:
|
|
|
1264
1264
|
help="Largest upload.",
|
|
1265
1265
|
)
|
|
1266
1266
|
@click.option("--no-browser", is_flag=True, help="Don't open a browser tab.")
|
|
1267
|
+
@click.option(
|
|
1268
|
+
"--export",
|
|
1269
|
+
"export_dir",
|
|
1270
|
+
type=click.Path(file_okay=False),
|
|
1271
|
+
help="Instead of starting a server, write a static version that runs plainml in the "
|
|
1272
|
+
"visitor's browser (for Vercel, GitHub Pages...).",
|
|
1273
|
+
)
|
|
1267
1274
|
def web(
|
|
1268
1275
|
host: str,
|
|
1269
1276
|
port: int,
|
|
@@ -1271,6 +1278,7 @@ def web(
|
|
|
1271
1278
|
token: str | None,
|
|
1272
1279
|
max_upload_mb: int,
|
|
1273
1280
|
no_browser: bool,
|
|
1281
|
+
export_dir: str | None,
|
|
1274
1282
|
) -> None:
|
|
1275
1283
|
"""Start a local website for everything plainml does.
|
|
1276
1284
|
|
|
@@ -1283,7 +1291,21 @@ def web(
|
|
|
1283
1291
|
plainml web
|
|
1284
1292
|
plainml web --port 9000 --runs-dir projects/churn/runs
|
|
1285
1293
|
plainml web --host 0.0.0.0 --token change-me (share on your network)
|
|
1294
|
+
plainml web --export site (static, runs in the browser)
|
|
1286
1295
|
"""
|
|
1296
|
+
if export_dir:
|
|
1297
|
+
from plainml.web.static_site import ExportError, export_static
|
|
1298
|
+
|
|
1299
|
+
try:
|
|
1300
|
+
out = export_static(export_dir)
|
|
1301
|
+
except ExportError as exc:
|
|
1302
|
+
raise PlainMLError(str(exc)) from exc
|
|
1303
|
+
success(f"Wrote the in-browser website to {esc(out)}")
|
|
1304
|
+
info("Try it locally: python -m http.server --directory " + esc(out))
|
|
1305
|
+
info(
|
|
1306
|
+
"Host it anywhere that serves static files (Vercel, GitHub Pages...): see docs/hosting.md"
|
|
1307
|
+
)
|
|
1308
|
+
return
|
|
1287
1309
|
from plainml.web.server import run_web
|
|
1288
1310
|
|
|
1289
1311
|
run_web(
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import math
|
|
6
6
|
import re
|
|
7
|
+
import sys
|
|
7
8
|
from collections.abc import Iterator
|
|
8
9
|
from contextlib import contextmanager
|
|
9
10
|
|
|
@@ -26,6 +27,10 @@ THEME = Theme(
|
|
|
26
27
|
|
|
27
28
|
console = Console(theme=THEME, highlight=False)
|
|
28
29
|
|
|
30
|
+
# Rich redraws spinners and progress bars from a background thread. Browsers (Pyodide, where
|
|
31
|
+
# sys.platform is "emscripten") can't start threads, so there bars only redraw on updates.
|
|
32
|
+
LIVE_REFRESH = sys.platform != "emscripten"
|
|
33
|
+
|
|
29
34
|
|
|
30
35
|
def set_quiet(enabled: bool) -> None:
|
|
31
36
|
console.quiet = enabled
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"""Small example datasets that ship with plainml, to try it without your own data.
|
|
2
|
+
|
|
3
|
+
They're the same synthetic files as the repository's ``examples/`` folder (no real people),
|
|
4
|
+
deliberately a bit messy, like real exports. The website offers each one in a click, with the
|
|
5
|
+
task and settings it suits already chosen.
|
|
6
|
+
|
|
7
|
+
from plainml.datasets import SAMPLES, path
|
|
8
|
+
path("churn") # -> Path to churn.csv inside the installed package
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
from dataclasses import dataclass, field
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
from typing import Any
|
|
16
|
+
|
|
17
|
+
from plainml.errors import PlainMLError
|
|
18
|
+
|
|
19
|
+
HERE = Path(__file__).parent
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class Sample:
|
|
24
|
+
key: str
|
|
25
|
+
file: str
|
|
26
|
+
title: str
|
|
27
|
+
question: str # what it answers, in a few words
|
|
28
|
+
about: str # what's in it, and what to look for
|
|
29
|
+
rows: int
|
|
30
|
+
task: str # the web app's task that suits it
|
|
31
|
+
options: dict[str, Any] = field(default_factory=dict) # that task's settings
|
|
32
|
+
|
|
33
|
+
def to_dict(self) -> dict[str, Any]:
|
|
34
|
+
return {
|
|
35
|
+
"key": self.key,
|
|
36
|
+
"file": self.file,
|
|
37
|
+
"title": self.title,
|
|
38
|
+
"question": self.question,
|
|
39
|
+
"about": self.about,
|
|
40
|
+
"rows": self.rows,
|
|
41
|
+
"task": self.task,
|
|
42
|
+
"options": dict(self.options),
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
SAMPLES = {
|
|
47
|
+
sample.key: sample
|
|
48
|
+
for sample in (
|
|
49
|
+
Sample(
|
|
50
|
+
"churn",
|
|
51
|
+
"churn.csv",
|
|
52
|
+
"Customer churn",
|
|
53
|
+
"Which subscribers will cancel?",
|
|
54
|
+
"Made-up subscribers, 18% of whom cancel. Look for how support calls and monthly "
|
|
55
|
+
"contracts raise the risk.",
|
|
56
|
+
1500,
|
|
57
|
+
"train",
|
|
58
|
+
{"target": "churned", "speed": "quick"},
|
|
59
|
+
),
|
|
60
|
+
Sample(
|
|
61
|
+
"house_prices",
|
|
62
|
+
"house_prices.csv",
|
|
63
|
+
"House prices",
|
|
64
|
+
"What will a house sell for?",
|
|
65
|
+
"Made-up house sales. Size, neighborhood and condition drive the price.",
|
|
66
|
+
1200,
|
|
67
|
+
"train",
|
|
68
|
+
{"target": "price", "speed": "quick"},
|
|
69
|
+
),
|
|
70
|
+
Sample(
|
|
71
|
+
"store_sales",
|
|
72
|
+
"store_sales.csv",
|
|
73
|
+
"Store sales",
|
|
74
|
+
"What will each store sell in the next two weeks?",
|
|
75
|
+
"Three made-up stores. Promotions lift sales by about a third, and the last two "
|
|
76
|
+
"weeks hold planned promotions but no sales yet.",
|
|
77
|
+
1680,
|
|
78
|
+
"forecast",
|
|
79
|
+
{
|
|
80
|
+
"target": "sales",
|
|
81
|
+
"group": "store",
|
|
82
|
+
"inputs": ["promo"],
|
|
83
|
+
"country": "US",
|
|
84
|
+
"horizon": 14,
|
|
85
|
+
},
|
|
86
|
+
),
|
|
87
|
+
Sample(
|
|
88
|
+
"daily_sales",
|
|
89
|
+
"daily_sales.csv",
|
|
90
|
+
"Daily sales",
|
|
91
|
+
"How many units will sell next month?",
|
|
92
|
+
"Two and a half years of one shop's daily sales, with a trend, busy weekends and a "
|
|
93
|
+
"yearly cycle.",
|
|
94
|
+
912,
|
|
95
|
+
"forecast",
|
|
96
|
+
{"target": "units_sold", "horizon": 30},
|
|
97
|
+
),
|
|
98
|
+
Sample(
|
|
99
|
+
"customers",
|
|
100
|
+
"customers.csv",
|
|
101
|
+
"Customer segments",
|
|
102
|
+
"What kinds of customers are there?",
|
|
103
|
+
"Made-up shoppers with three hidden segments: young app users, big-spending store "
|
|
104
|
+
"shoppers and frequent web visitors.",
|
|
105
|
+
600,
|
|
106
|
+
"cluster",
|
|
107
|
+
),
|
|
108
|
+
Sample(
|
|
109
|
+
"transactions",
|
|
110
|
+
"transactions.csv",
|
|
111
|
+
"Card payments",
|
|
112
|
+
"Which payments look suspicious?",
|
|
113
|
+
"Made-up card payments, 30 of them fraud. The is_fraud column marks those, so you "
|
|
114
|
+
"can see how many the detectors catch.",
|
|
115
|
+
3000,
|
|
116
|
+
"anomaly",
|
|
117
|
+
{"label": "is_fraud"},
|
|
118
|
+
),
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def get(key: str) -> Sample:
|
|
124
|
+
"""The example dataset called ``key``."""
|
|
125
|
+
if key not in SAMPLES:
|
|
126
|
+
raise PlainMLError(
|
|
127
|
+
f"No example dataset called '{key}'.", hint="Choose one of: " + ", ".join(SAMPLES)
|
|
128
|
+
)
|
|
129
|
+
return SAMPLES[key]
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def path(key: str) -> Path:
|
|
133
|
+
"""Where the example dataset called ``key`` is, inside the installed package."""
|
|
134
|
+
return HERE / get(key).file
|