datatoolpack 0.10.1__tar.gz → 0.11.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.
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/PKG-INFO +43 -1
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/README.md +42 -0
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/datatoolpack/__init__.py +1 -1
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/datatoolpack/client.py +147 -2
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/datatoolpack.egg-info/PKG-INFO +43 -1
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/setup.py +1 -1
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/datatoolpack.egg-info/SOURCES.txt +0 -0
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/datatoolpack.egg-info/dependency_links.txt +0 -0
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/datatoolpack.egg-info/requires.txt +0 -0
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/datatoolpack.egg-info/top_level.txt +0 -0
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/pyproject.toml +0 -0
- {datatoolpack-0.10.1 → datatoolpack-0.11.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datatoolpack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary: Official Python SDK for the AutoData ML data preparation pipeline API
|
|
5
5
|
Home-page: https://autodata.datatoolpack.com
|
|
6
6
|
Author: AutoData Team
|
|
@@ -313,6 +313,48 @@ ranking = client.recommend_features(
|
|
|
313
313
|
|
|
314
314
|
---
|
|
315
315
|
|
|
316
|
+
## Inference & Retraining (v0.11.0+)
|
|
317
|
+
|
|
318
|
+
Apply a **completed** session's fitted transforms to new data — the missing
|
|
319
|
+
half of the ML lifecycle: train once, then score fresh production rows with
|
|
320
|
+
*exactly* the same encoding, imputation and scaling.
|
|
321
|
+
|
|
322
|
+
### `client.infer(...)` — Score new data
|
|
323
|
+
|
|
324
|
+
Lightweight pipeline (Anomaly Detection → DTC → MDH → CDS). Outputs
|
|
325
|
+
`features.csv` (+ `y_columns.csv` if targets are present in the new file).
|
|
326
|
+
|
|
327
|
+
```python
|
|
328
|
+
result = client.infer(
|
|
329
|
+
original_session_id="5d3bc0f0-...", # a completed training session you own
|
|
330
|
+
file_path="new_rows.csv", # columns must match the training data
|
|
331
|
+
download_path="./scored", # optional: save outputs locally
|
|
332
|
+
return_dataframes=True, # optional: get pandas DataFrames back
|
|
333
|
+
)
|
|
334
|
+
features_df = result["dataframes"]["features"]
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### `client.retrain(...)` — Refresh a training set with new rows
|
|
338
|
+
|
|
339
|
+
Full pipeline including Split → CDS → DSM → DSG; produces
|
|
340
|
+
`retraining_output.csv` (features + targets combined).
|
|
341
|
+
|
|
342
|
+
```python
|
|
343
|
+
result = client.retrain(
|
|
344
|
+
original_session_id="5d3bc0f0-...",
|
|
345
|
+
file_path="new_rows.csv",
|
|
346
|
+
run_dsg=True, output_rows=20000, # synthetic augmentation target
|
|
347
|
+
download_path="./retrained",
|
|
348
|
+
)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Both calls are **synchronous** (the response arrives when processing ends;
|
|
352
|
+
default per-request timeout is ≥ 900 s — raise `timeout=` for very large
|
|
353
|
+
files), require the original session to be **completed and owned by you**,
|
|
354
|
+
and are free of credit charges in v1.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
316
358
|
## API Keys & Usage
|
|
317
359
|
|
|
318
360
|
### `client.list_keys()` — List API keys
|
|
@@ -276,6 +276,48 @@ ranking = client.recommend_features(
|
|
|
276
276
|
|
|
277
277
|
---
|
|
278
278
|
|
|
279
|
+
## Inference & Retraining (v0.11.0+)
|
|
280
|
+
|
|
281
|
+
Apply a **completed** session's fitted transforms to new data — the missing
|
|
282
|
+
half of the ML lifecycle: train once, then score fresh production rows with
|
|
283
|
+
*exactly* the same encoding, imputation and scaling.
|
|
284
|
+
|
|
285
|
+
### `client.infer(...)` — Score new data
|
|
286
|
+
|
|
287
|
+
Lightweight pipeline (Anomaly Detection → DTC → MDH → CDS). Outputs
|
|
288
|
+
`features.csv` (+ `y_columns.csv` if targets are present in the new file).
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
result = client.infer(
|
|
292
|
+
original_session_id="5d3bc0f0-...", # a completed training session you own
|
|
293
|
+
file_path="new_rows.csv", # columns must match the training data
|
|
294
|
+
download_path="./scored", # optional: save outputs locally
|
|
295
|
+
return_dataframes=True, # optional: get pandas DataFrames back
|
|
296
|
+
)
|
|
297
|
+
features_df = result["dataframes"]["features"]
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### `client.retrain(...)` — Refresh a training set with new rows
|
|
301
|
+
|
|
302
|
+
Full pipeline including Split → CDS → DSM → DSG; produces
|
|
303
|
+
`retraining_output.csv` (features + targets combined).
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
result = client.retrain(
|
|
307
|
+
original_session_id="5d3bc0f0-...",
|
|
308
|
+
file_path="new_rows.csv",
|
|
309
|
+
run_dsg=True, output_rows=20000, # synthetic augmentation target
|
|
310
|
+
download_path="./retrained",
|
|
311
|
+
)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Both calls are **synchronous** (the response arrives when processing ends;
|
|
315
|
+
default per-request timeout is ≥ 900 s — raise `timeout=` for very large
|
|
316
|
+
files), require the original session to be **completed and owned by you**,
|
|
317
|
+
and are free of credit charges in v1.
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
279
321
|
## API Keys & Usage
|
|
280
322
|
|
|
281
323
|
### `client.list_keys()` — List API keys
|
|
@@ -789,7 +789,8 @@ class AutoDataClient:
|
|
|
789
789
|
Object storage / data lakes / files:
|
|
790
790
|
``s3``, ``gcs``, ``azure_blob``, ``adls_gen2`` (Azure
|
|
791
791
|
Data Lake Storage Gen2), ``delta`` (Delta Lake),
|
|
792
|
-
``google_sheets
|
|
792
|
+
``google_sheets``, ``google_drive``, ``dropbox``,
|
|
793
|
+
``onedrive``, ``box``.
|
|
793
794
|
|
|
794
795
|
Streaming & IoT / time-series:
|
|
795
796
|
``kafka``, ``kinesis``, ``mqtt``, ``opcua`` (OPC-UA),
|
|
@@ -975,7 +976,7 @@ class AutoDataClient:
|
|
|
975
976
|
"excluded_columns": adv.get("excluded_columns", []),
|
|
976
977
|
"text_mode": adv.get("text_mode", 0),
|
|
977
978
|
"text_cleaning": adv.get("text_cleaning", True),
|
|
978
|
-
"mdh_mode": adv.get("mdh_mode",
|
|
979
|
+
"mdh_mode": adv.get("mdh_mode", 0),
|
|
979
980
|
"zscore_limit": adv.get("zscore_limit", 3.0),
|
|
980
981
|
"similarity_p": adv.get("similarity_p", 95),
|
|
981
982
|
"dsg_mode": adv.get("dsg_mode", "copula"),
|
|
@@ -1307,6 +1308,150 @@ class AutoDataClient:
|
|
|
1307
1308
|
self._raise_for_error(r)
|
|
1308
1309
|
return r.json()
|
|
1309
1310
|
|
|
1311
|
+
# ------------------------------------------------------------------
|
|
1312
|
+
# Inference & retraining — apply a COMPLETED session to new data
|
|
1313
|
+
# ------------------------------------------------------------------
|
|
1314
|
+
|
|
1315
|
+
def infer(
|
|
1316
|
+
self,
|
|
1317
|
+
original_session_id: str,
|
|
1318
|
+
file_path: str,
|
|
1319
|
+
enable_anomaly_detection: Optional[bool] = None,
|
|
1320
|
+
download_path: Optional[str] = None,
|
|
1321
|
+
return_dataframes: bool = False,
|
|
1322
|
+
timeout: Optional[float] = None,
|
|
1323
|
+
) -> Dict:
|
|
1324
|
+
"""Score a new CSV with a completed session's fitted transforms.
|
|
1325
|
+
|
|
1326
|
+
Runs the lightweight inference pipeline server-side (Anomaly
|
|
1327
|
+
Detection → DTC → MDH → CDS) using the artifacts the original
|
|
1328
|
+
training run stored, so new rows get *exactly* the same encoding,
|
|
1329
|
+
imputation and scaling as the training data. Synchronous — the call
|
|
1330
|
+
returns when the server finishes; raise ``timeout`` for big files.
|
|
1331
|
+
|
|
1332
|
+
Args:
|
|
1333
|
+
original_session_id: A COMPLETED pipeline session owned by the
|
|
1334
|
+
caller (the ``session_id`` returned by
|
|
1335
|
+
:meth:`process` / :meth:`process_from_connector`).
|
|
1336
|
+
file_path: Local CSV with new rows to score. Column
|
|
1337
|
+
names must match the original training data.
|
|
1338
|
+
enable_anomaly_detection: Override the original session's anomaly
|
|
1339
|
+
setting; ``None`` inherits it.
|
|
1340
|
+
download_path: Directory to save ``features.csv`` /
|
|
1341
|
+
``y_columns.csv`` into (skipped when None).
|
|
1342
|
+
return_dataframes: Also load the CSV outputs into a
|
|
1343
|
+
``dataframes`` dict (requires pandas).
|
|
1344
|
+
timeout: Per-request timeout in seconds
|
|
1345
|
+
(default ``max(client timeout, 900)``).
|
|
1346
|
+
|
|
1347
|
+
Returns:
|
|
1348
|
+
Server result dict: ``status``, ``new_session_id``,
|
|
1349
|
+
``output_files`` — plus ``files`` (local paths) when downloaded
|
|
1350
|
+
and ``dataframes`` when requested.
|
|
1351
|
+
"""
|
|
1352
|
+
extra: Dict[str, str] = {}
|
|
1353
|
+
if enable_anomaly_detection is not None:
|
|
1354
|
+
extra["enableAnomalyDetection"] = (
|
|
1355
|
+
"true" if enable_anomaly_detection else "false")
|
|
1356
|
+
return self._apply_session(
|
|
1357
|
+
"/inference", original_session_id, file_path, extra,
|
|
1358
|
+
download_path, return_dataframes, timeout)
|
|
1359
|
+
|
|
1360
|
+
def retrain(
|
|
1361
|
+
self,
|
|
1362
|
+
original_session_id: str,
|
|
1363
|
+
file_path: str,
|
|
1364
|
+
run_dsm: bool = True,
|
|
1365
|
+
run_dsg: bool = True,
|
|
1366
|
+
output_rows: Optional[int] = None,
|
|
1367
|
+
enable_anomaly_detection: Optional[bool] = None,
|
|
1368
|
+
download_path: Optional[str] = None,
|
|
1369
|
+
return_dataframes: bool = False,
|
|
1370
|
+
timeout: Optional[float] = None,
|
|
1371
|
+
) -> Dict:
|
|
1372
|
+
"""Re-run the FULL pipeline on new data with a completed session's config.
|
|
1373
|
+
|
|
1374
|
+
Unlike :meth:`infer` this includes the downstream stages
|
|
1375
|
+
(… → Split → CDS → DSM → DSG) and produces ``retraining_output.csv``
|
|
1376
|
+
(features + targets combined) — use it to refresh a training set with
|
|
1377
|
+
newly arrived rows. Synchronous, like :meth:`infer`.
|
|
1378
|
+
|
|
1379
|
+
Args:
|
|
1380
|
+
original_session_id: A COMPLETED session owned by the caller.
|
|
1381
|
+
file_path: Local CSV with the new training rows.
|
|
1382
|
+
run_dsm: Run the data-splitting stage (default True).
|
|
1383
|
+
run_dsg: Run synthetic generation (default True).
|
|
1384
|
+
output_rows: DSG target row count (None = server default).
|
|
1385
|
+
enable_anomaly_detection: Override; ``None`` inherits the original.
|
|
1386
|
+
download_path: Directory to save the output files into.
|
|
1387
|
+
return_dataframes: Also load CSV outputs as DataFrames.
|
|
1388
|
+
timeout: Per-request timeout (default ≥ 900s).
|
|
1389
|
+
|
|
1390
|
+
Returns:
|
|
1391
|
+
Server result dict: ``status``, ``new_session_id``,
|
|
1392
|
+
``output_files`` [+ ``files`` / ``dataframes``].
|
|
1393
|
+
"""
|
|
1394
|
+
extra = {
|
|
1395
|
+
"run_dsm": "true" if run_dsm else "false",
|
|
1396
|
+
"run_dsg": "true" if run_dsg else "false",
|
|
1397
|
+
}
|
|
1398
|
+
if output_rows is not None:
|
|
1399
|
+
extra["output_sample_size"] = str(output_rows)
|
|
1400
|
+
if enable_anomaly_detection is not None:
|
|
1401
|
+
extra["enableAnomalyDetection"] = (
|
|
1402
|
+
"true" if enable_anomaly_detection else "false")
|
|
1403
|
+
return self._apply_session(
|
|
1404
|
+
"/retraining", original_session_id, file_path, extra,
|
|
1405
|
+
download_path, return_dataframes, timeout)
|
|
1406
|
+
|
|
1407
|
+
def _apply_session(
|
|
1408
|
+
self,
|
|
1409
|
+
endpoint: str,
|
|
1410
|
+
original_session_id: str,
|
|
1411
|
+
file_path: str,
|
|
1412
|
+
extra_form: Dict[str, str],
|
|
1413
|
+
download_path: Optional[str],
|
|
1414
|
+
return_dataframes: bool,
|
|
1415
|
+
timeout: Optional[float],
|
|
1416
|
+
) -> Dict:
|
|
1417
|
+
"""Shared upload/response handling for :meth:`infer` / :meth:`retrain`."""
|
|
1418
|
+
data = {"original_session_id": original_session_id}
|
|
1419
|
+
data.update(extra_form)
|
|
1420
|
+
effective_timeout = timeout if timeout is not None else max(self.timeout, 900)
|
|
1421
|
+
with open(file_path, "rb") as f:
|
|
1422
|
+
r = self._request(
|
|
1423
|
+
"POST",
|
|
1424
|
+
self._url(endpoint),
|
|
1425
|
+
files={"file": (os.path.basename(file_path), f, "text/csv")},
|
|
1426
|
+
data=data,
|
|
1427
|
+
timeout=effective_timeout,
|
|
1428
|
+
)
|
|
1429
|
+
self._raise_for_error(r)
|
|
1430
|
+
result = r.json()
|
|
1431
|
+
|
|
1432
|
+
new_session_id = result.get("new_session_id")
|
|
1433
|
+
outputs = result.get("output_files") or []
|
|
1434
|
+
if new_session_id and (download_path or return_dataframes):
|
|
1435
|
+
import tempfile
|
|
1436
|
+
target_dir = download_path or tempfile.mkdtemp(prefix="autodata_infer_")
|
|
1437
|
+
files: Dict[str, str] = {}
|
|
1438
|
+
for out in outputs:
|
|
1439
|
+
name = out.get("name")
|
|
1440
|
+
if not name:
|
|
1441
|
+
continue
|
|
1442
|
+
local = os.path.join(target_dir, name)
|
|
1443
|
+
self.download_file(
|
|
1444
|
+
self._url(f"/download/{new_session_id}/{name}"), local)
|
|
1445
|
+
files[name] = local
|
|
1446
|
+
result["files"] = files
|
|
1447
|
+
if return_dataframes:
|
|
1448
|
+
pd = self._require_pandas()
|
|
1449
|
+
result["dataframes"] = {
|
|
1450
|
+
os.path.splitext(name)[0]: pd.read_csv(path)
|
|
1451
|
+
for name, path in files.items() if name.endswith(".csv")
|
|
1452
|
+
}
|
|
1453
|
+
return result
|
|
1454
|
+
|
|
1310
1455
|
def apply_mapping(
|
|
1311
1456
|
self,
|
|
1312
1457
|
session_id: str,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datatoolpack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0
|
|
4
4
|
Summary: Official Python SDK for the AutoData ML data preparation pipeline API
|
|
5
5
|
Home-page: https://autodata.datatoolpack.com
|
|
6
6
|
Author: AutoData Team
|
|
@@ -313,6 +313,48 @@ ranking = client.recommend_features(
|
|
|
313
313
|
|
|
314
314
|
---
|
|
315
315
|
|
|
316
|
+
## Inference & Retraining (v0.11.0+)
|
|
317
|
+
|
|
318
|
+
Apply a **completed** session's fitted transforms to new data — the missing
|
|
319
|
+
half of the ML lifecycle: train once, then score fresh production rows with
|
|
320
|
+
*exactly* the same encoding, imputation and scaling.
|
|
321
|
+
|
|
322
|
+
### `client.infer(...)` — Score new data
|
|
323
|
+
|
|
324
|
+
Lightweight pipeline (Anomaly Detection → DTC → MDH → CDS). Outputs
|
|
325
|
+
`features.csv` (+ `y_columns.csv` if targets are present in the new file).
|
|
326
|
+
|
|
327
|
+
```python
|
|
328
|
+
result = client.infer(
|
|
329
|
+
original_session_id="5d3bc0f0-...", # a completed training session you own
|
|
330
|
+
file_path="new_rows.csv", # columns must match the training data
|
|
331
|
+
download_path="./scored", # optional: save outputs locally
|
|
332
|
+
return_dataframes=True, # optional: get pandas DataFrames back
|
|
333
|
+
)
|
|
334
|
+
features_df = result["dataframes"]["features"]
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### `client.retrain(...)` — Refresh a training set with new rows
|
|
338
|
+
|
|
339
|
+
Full pipeline including Split → CDS → DSM → DSG; produces
|
|
340
|
+
`retraining_output.csv` (features + targets combined).
|
|
341
|
+
|
|
342
|
+
```python
|
|
343
|
+
result = client.retrain(
|
|
344
|
+
original_session_id="5d3bc0f0-...",
|
|
345
|
+
file_path="new_rows.csv",
|
|
346
|
+
run_dsg=True, output_rows=20000, # synthetic augmentation target
|
|
347
|
+
download_path="./retrained",
|
|
348
|
+
)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
Both calls are **synchronous** (the response arrives when processing ends;
|
|
352
|
+
default per-request timeout is ≥ 900 s — raise `timeout=` for very large
|
|
353
|
+
files), require the original session to be **completed and owned by you**,
|
|
354
|
+
and are free of credit charges in v1.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
316
358
|
## API Keys & Usage
|
|
317
359
|
|
|
318
360
|
### `client.list_keys()` — List API keys
|
|
@@ -7,7 +7,7 @@ with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="datatoolpack",
|
|
10
|
-
version="0.
|
|
10
|
+
version="0.11.0",
|
|
11
11
|
description="Official Python SDK for the AutoData ML data preparation pipeline API",
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type="text/markdown",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|