Metadata-Version: 2.4
Name: kumo-engine
Version: 1.1.0
Requires-Python: >=3.11
License-Expression: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND ISC AND MIT AND Unicode-3.0 AND Zlib
License-File: LICENSE
License-File: THIRD-PARTY.txt
Summary: Local, in-process relational deep learning with Kumo
Keywords: deep-learning,graph-neural-networks
Author: NVIDIA Corporation
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: GPU :: NVIDIA CUDA
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Project-URL: Homepage, https://github.com/NVIDIA/kumo-engine
Project-URL: Documentation, https://docs.nvidia.com/sdgm/kumo-engine/get-started-with-kumo-engine/overview
Project-URL: Release notes, https://docs.nvidia.com/sdgm/kumo-engine/resources/release-notes
Project-URL: Source, https://github.com/NVIDIA/kumo-engine/tree/main/packages/kumo-engine
Project-URL: Issues, https://github.com/NVIDIA/kumo-engine/issues
Provides-Extra: plots
Provides-Extra: cpu
Provides-Extra: snowflake
Provides-Extra: databricks
Provides-Extra: bigquery
Provides-Extra: s3
Provides-Extra: text
Provides-Extra: adls
Provides-Extra: gcs
Provides-Extra: mlflow
Provides-Extra: sagemaker
Requires-Dist: pandas
Requires-Dist: pyarrow>=8.0.0
Requires-Dist: typing_extensions>=4.5.0
Requires-Dist: pydantic>=2.7
Requires-Dist: pydantic-core<3,>=2
Requires-Dist: numpy
Requires-Dist: tabulate<1,>=0.8.10
Requires-Dist: typing_extensions>=4.12.2
Requires-Dist: pydantic>=1.10.21
Requires-Dist: filelock>=3.29.5
Requires-Dist: numpy>=1.26,<3
Requires-Dist: pyarrow>=16,<25
Requires-Dist: filelock>=3.13.1
Requires-Dist: fsspec>=2023.5.0
Requires-Dist: antlr4-python3-runtime==4.9.3
Requires-Dist: pandas<3,>=1.5
Requires-Dist: matplotlib>=3.10.0
Requires-Dist: numpy<3,>=1.26
Requires-Dist: optuna<5,>=4
Requires-Dist: pyarrow<25,>=15
Requires-Dist: pydantic>=2.11
Requires-Dist: pydantic-core
Requires-Dist: scikit-learn>=1.6.1
Requires-Dist: sqlglot==30.17.*
Requires-Dist: torch<3,>=2.7.0
Requires-Dist: pytorch-lightning==2.6.6
Requires-Dist: psutil==7.2.2
Requires-Dist: tabulate==0.8.10
Requires-Dist: tensorboard<3,>=2.16.2
Requires-Dist: pytorch-frame==0.3.0
Requires-Dist: torch-geometric<3,>=2.8.1
Requires-Dist: torchmetrics==1.8.1
Requires-Dist: typing-extensions>=4.12.2
Requires-Dist: faiss-gpu==1.14.3; sys_platform == "linux" and platform_machine == "x86_64"
Requires-Dist: faiss-cpu==1.14.3; sys_platform == "darwin"
Requires-Dist: matplotlib>=3.10.0; extra == "plots"
Requires-Dist: faiss-cpu==1.14.3; ((sys_platform != "linux" or platform_machine != "x86_64")) and extra == "cpu"
Requires-Dist: cryptography>=50; extra == "snowflake"
Requires-Dist: numpy<3,>=1.26; extra == "snowflake"
Requires-Dist: pydantic>=2.11; extra == "snowflake"
Requires-Dist: pyarrow>=14; extra == "snowflake"
Requires-Dist: snowflake-connector-python>=4.3; extra == "snowflake"
Requires-Dist: requests>=2.31; extra == "snowflake"
Requires-Dist: pandas<3,>=1.5; extra == "snowflake"
Requires-Dist: snowflake-snowpark-python; extra == "snowflake"
Requires-Dist: snowflake-ml-python<3,>=2.0; extra == "snowflake"
Requires-Dist: pyyaml; extra == "snowflake"
Requires-Dist: databricks-sql-connector>=4.5.0; extra == "databricks"
Requires-Dist: databricks-sdk>=0.49; extra == "databricks"
Requires-Dist: pandas<3,>=1.5; extra == "databricks"
Requires-Dist: pyarrow>=14; extra == "databricks"
Requires-Dist: pydantic>=2.11; extra == "databricks"
Requires-Dist: databricks-sdk>=0.68; extra == "databricks"
Requires-Dist: google-api-core<3,>=2; extra == "bigquery"
Requires-Dist: google-auth[requests]<3,>=2.14.1; extra == "bigquery"
Requires-Dist: google-cloud-bigquery>=3.36; extra == "bigquery"
Requires-Dist: google-cloud-bigquery-storage>=2.39; extra == "bigquery"
Requires-Dist: google-cloud-storage>=2.14; extra == "bigquery"
Requires-Dist: google-resumable-media<3,>=2; extra == "bigquery"
Requires-Dist: pyarrow>=14; extra == "bigquery"
Requires-Dist: boto3>=1.34; extra == "s3"
Requires-Dist: botocore<2,>=1.34; extra == "s3"
Requires-Dist: pydantic>=2.11; extra == "s3"
Requires-Dist: pyarrow>=14; extra == "s3"
Requires-Dist: kumo-glove-6b-50d<2,>=1.0.0; extra == "text"
Requires-Dist: pyarrow<25,>=16; extra == "adls"
Requires-Dist: fsspec; extra == "adls"
Requires-Dist: requests<3,>=2.31; extra == "adls"
Requires-Dist: azure-core<2,>=1.31; extra == "adls"
Requires-Dist: azure-identity<2,>=1.25; extra == "adls"
Requires-Dist: azure-storage-file-datalake<13,>=12.22; extra == "adls"
Requires-Dist: pyarrow>=14; extra == "gcs"
Requires-Dist: fsspec; extra == "gcs"
Requires-Dist: google-api-core<3,>=2; extra == "gcs"
Requires-Dist: google-auth[requests]; extra == "gcs"
Requires-Dist: google-cloud-storage>=3.1.0; extra == "gcs"
Requires-Dist: google-resumable-media<3,>=2; extra == "gcs"
Requires-Dist: mlflow-skinny<4,>=3.5; extra == "mlflow"
Requires-Dist: nvidia-ml-py; extra == "mlflow"
Requires-Dist: boto3>=1.34; extra == "sagemaker"
Requires-Dist: botocore<2,>=1.34; extra == "sagemaker"
Requires-Dist: pydantic>=2.11; extra == "sagemaker"
Requires-Dist: pyarrow>=14; extra == "sagemaker"
Requires-Dist: mlflow-skinny<4,>=3.5; extra == "sagemaker"
Requires-Dist: nvidia-ml-py; extra == "sagemaker"
Requires-Dist: sagemaker-mlflow>=0.5.0; extra == "sagemaker"

<!-- This README is also the PyPI project description: keep every link absolute. -->
<p align="center">
  <img height="180" src="https://raw.githubusercontent.com/NVIDIA/kumo-engine/main/ui/src/images/kumo_logo_green.svg" alt="Kumo" />
</p>

# Kumo Engine

**Kumo Engine is an accelerator for context generation over structured data.** It stores your tables and their relationships as a graph on disk and, for each entity, samples the related records up to its prediction time. Describe what to predict in one query, and Kumo Engine uses that context to train and run predictive models directly on your relational data.

Kumo Engine is part of [NVIDIA Kumo](https://docs.nvidia.com/sdgm/about-nvidia-kumo/overview), a family of open models and accelerated libraries for predictive AI on tabular, relational, and time-series data. For an overview of its capabilities and design, see the [Kumo Engine repository](https://github.com/NVIDIA/kumo-engine).

## Installation

```bash
pip install kumo-engine
```

| Requirement | Details |
| --- | --- |
| Python | CPython 3.11 or later |
| Operating system | Linux x86-64 or ARM64 with glibc 2.34 or later, macOS 14 or later on Apple silicon, or Windows through WSL2 (x86-64) |
| CPU | AES and SSE2 instructions on x86-64, or AES and NEON on ARM64 |
| GPU | An NVIDIA GPU for production workloads. The quickstart and other small datasets also run on a CPU or an Apple silicon GPU. |
| Storage | A local NVMe SSD for production workloads. Network-attached volumes, such as Amazon EBS, make sampling much slower. |

The base package reads and writes local CSV and Parquet files. Optional extras add connectors and additional features; combine them as needed, for example `pip install "kumo-engine[snowflake,text]"`.

| Extra | Adds |
| --- | --- |
| `s3` | Amazon S3 |
| `gcs` | Google Cloud Storage |
| `adls` | Azure Data Lake Storage Gen2 |
| `bigquery` | BigQuery |
| `snowflake` | Snowflake, including Snowflake notebooks |
| `databricks` | Databricks, including Databricks notebooks |
| `text` | Encoding for free-text columns, such as descriptions or reviews, with GloVe 6B 50d word vectors |
| `mlflow` | MLflow run tracking and model registry |
| `sagemaker` | SageMaker managed MLflow |

Kumo Engine trains on an NVIDIA GPU or an Apple silicon GPU when one is available, and on the CPU otherwise. To choose the device, pass `accelerator="gpu"`, `"mps"`, or `"cpu"` to `Trainer`.

Recommendation tasks use Faiss for retrieval. On Linux x86-64 and macOS, `pip install kumo-engine` installs Faiss as a dependency. On Linux ARM64, Faiss is optional, and other tasks run without it. To run recommendation tasks there, install CPU Faiss with `pip install "kumo-engine[cpu]"` and pass `accelerator="cpu"` to `Trainer`, or follow the [DGX Spark guide](https://github.com/NVIDIA/kumo-engine/blob/main/packages/kumo-engine/dgx-spark.md) to build GPU Faiss. The guide also covers CUDA training on ARM64.

On NVIDIA GPUs, the optional `torch-scatter` package speeds up some training workloads. Install the build for your PyTorch and CUDA versions as described in [PyG's installation guide](https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html).

## Quickstart

This example trains a model that predicts which users will place an order in the next 30 days, using a sample dataset of users and orders that ships with the package.

```python
from kumo.engine import (Edge, FileConnector, Graph, PredictiveQuery, Table,
                         Trainer, datasets)

files = FileConnector(root_dir=datasets.shop())
users = Table.from_source_table(files["users"], primary_key="user_id")
orders = Table.from_source_table(files["orders"], primary_key="order_id",
                                 time_column="order_time")
graph = Graph(
    tables={"users": users, "orders": orders},
    edges=[Edge(src_table="orders", fkey="user_id", dst_table="users")],
)
snapshot = graph.snapshot()

pquery = PredictiveQuery(
    graph, "PREDICT COUNT(orders.*, 0, 30, days) > 0 FOR EACH users.user_id")
trainer = Trainer(pquery.suggest_model_plan(snapshot))
training_result = trainer.fit(pquery.generate_training_table(snapshot),
                              snapshot=snapshot)

result = trainer.predict(pquery.generate_prediction_table(snapshot),
                         snapshot=snapshot, binary_classification_threshold=0.5)
print(result.frame.head())
```

When training completes, the example prints the first five predictions:

```text
   ENTITY  TARGET_PRED  False_PROB  True_PROB
0     625         True    0.118336   0.881664
1     631         True    0.110448   0.889552
2     505         True    0.172911   0.827089
3     519        False    0.939077   0.060923
4     752        False    0.939077   0.060923
```

`result.frame` has one row per user, with the predicted label `TARGET_PRED` and the class probabilities `False_PROB` and `True_PROB`. The prediction time defaults to the latest `order_time` in the snapshot, so predictions cover the 30 days after it. Exact values can differ between runs. To use your own data, point `FileConnector` at a directory of CSV or Parquet files.

`graph.snapshot()` writes the graph to a scratch directory, `~/.cache/kumo-engine` by default, which also holds training runs, model bundles, and predictions. If your home directory is on a network volume, such as an Amazon EBS boot volume, call `kumo.engine.configure(scratch_dir=...)` before taking the snapshot to use a directory on a local NVMe SSD instead.

## Next Steps

### Use a Coding Agent

The bundled agent skill teaches your coding agent the Kumo Engine API, so it can build, train, and run models on your data. To install it for the coding agents on your machine, run:

```bash
python -m kumo.engine.skills
```

In a Databricks notebook, call `kumo.engine.install_skills()` to install it for Genie Code. For Cortex Code in a Snowflake notebook, call `kumo.engine.install_skills("coco", scope="workspace", workspace="<workspace>")`. See [Get Started with Agents](https://docs.nvidia.com/sdgm/kumo-engine/get-started-with-kumo-engine/agents).

### Visualize Table Relationships

Before training, check your tables, keys, and relationships in an interactive notebook diagram, or export the diagram as SVG, PDF, or Markdown:

```python
graph.visualize()
_ = graph.visualize("graph.pdf", show_cols=True)
```

See [Visualize Table Relationships](https://docs.nvidia.com/sdgm/kumo-engine/user-code-guide/set-up-a-graph/graphs#visualize-table-relationships).

### Explain a Trained Model

`training_result.explanations` reads the column importance scores and other diagnostics recorded during training:

```python
explanations = training_result.explanations
if explanations.availability["gradient"].available:
    print(explanations.gradient_scores().to_pandas())
```

See the [training explanations guide](https://github.com/NVIDIA/kumo-engine/blob/main/packages/kumo-engine/explainability.md) for plots, column cohorts, and sampled training context.

### Run in Production

For run tracking, model versioning, and drift monitoring with MLflow, Databricks, SageMaker, or Snowflake, see the [MLOps guide](https://github.com/NVIDIA/kumo-engine/blob/main/packages/kumo-engine/docs/mlops.md).

## Documentation

- [Kumo Engine documentation](https://docs.nvidia.com/sdgm/kumo-engine/get-started-with-kumo-engine/overview): prerequisites, setup guides, and end-to-end workflows.
- [User Code Guide](https://docs.nvidia.com/sdgm/kumo-engine/user-code-guide/set-up-a-graph/tables): connect data, define tables and graphs, train, and predict.
- [Predictive Query Examples](https://docs.nvidia.com/sdgm/kumo-engine/get-started-with-kumo-engine/workflows-and-solutions/predictive-query-examples): common prediction tasks written as predictive queries.
- [Release notes](https://docs.nvidia.com/sdgm/kumo-engine/resources/release-notes): changes, compatibility, and known issues for each release.

## Support

Report bugs and request features in [GitHub Issues](https://github.com/NVIDIA/kumo-engine/issues). To report a security vulnerability, follow [SECURITY.md](https://github.com/NVIDIA/kumo-engine/blob/main/SECURITY.md) instead of opening an issue.

## License

Kumo Engine is licensed under the [Apache License 2.0](https://github.com/NVIDIA/kumo-engine/blob/main/LICENSE). The wheel also bundles third-party components under their own licenses, listed in [THIRD-PARTY.txt](https://github.com/NVIDIA/kumo-engine/blob/main/THIRD-PARTY.txt).

