Metadata-Version: 2.5
Name: ectype-data
Version: 0.2.0
Summary: Ectype: learn a statistical fingerprint of a table, generate faithful synthetic data, and prove how faithful it is.
Project-URL: Homepage, https://github.com/EctypeHQ/ectype
Project-URL: Documentation, https://github.com/EctypeHQ/ectype/tree/main/docs/guide
Project-URL: Issues, https://github.com/EctypeHQ/ectype/issues
Author: ZeroPoint Holdings LLC
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: copula,data profiling,drift,fingerprint,synthetic data,tabular
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: numpy>=1.26
Requires-Dist: polars>=1.0
Requires-Dist: pyarrow>=15
Requires-Dist: pydantic>=2.6
Requires-Dist: scipy>=1.11
Provides-Extra: all
Requires-Dist: anthropic>=0.40; extra == 'all'
Requires-Dist: duckdb>=1.0; extra == 'all'
Requires-Dist: pandas>=2.1; extra == 'all'
Requires-Dist: statsmodels>=0.14; extra == 'all'
Provides-Extra: llm
Requires-Dist: anthropic>=0.40; extra == 'llm'
Provides-Extra: neural
Requires-Dist: torch>=2.2; extra == 'neural'
Provides-Extra: pandas
Requires-Dist: pandas>=2.1; extra == 'pandas'
Provides-Extra: sql
Requires-Dist: duckdb>=1.0; extra == 'sql'
Provides-Extra: temporal
Requires-Dist: statsmodels>=0.14; extra == 'temporal'
Description-Content-Type: text/markdown

<div align="center">

# Ectype

Learn the statistical fingerprint of a table, generate unlimited realistic rows from it, and
prove how faithful they are.

```text
              ▄██▄                    
             ▄█████       ▄████▄      
            ▄███████▄   ▄████████▄    
original  ▄████████████████████████▄▄ 
──────────────────────────────────────
ectype    ▀████████████████████████▀▀ 
            ▀███████    ▀▀███████▀    
             ▀█████        ▀██▀▀▀     
               ██▀                    
```

[![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-3776AB)](#install)
[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](LICENSE)
[![Status: alpha](https://img.shields.io/badge/status-alpha-orange)](#status)
[![Local-first](https://img.shields.io/badge/runs-fully%20local-2ea44f)](#why-ectype)

[Quickstart](#quickstart) · [Features](#features) · [Uses](#what-people-use-it-for) · [Guide](docs/guide/README.md) · [Format spec](docs/format/README.md)

</div>

---

*An **ectype** is a faithful reproduction of an original: the counterpart of an archetype.*

**Ectype learns a fingerprint of your table**: a small, portable, inspectable file that
captures how your data behaves. That includes distributions, dependencies, missingness, constraints, time patterns and relationships
between tables. From the fingerprint you can generate any number of rows, simulate what-if
scenarios and detect drift, and you never need the original data again.

The validator also measures fidelity on held-back targets the generator was never tuned on, so
the report reflects how well the generator reproduces the data rather than how well the
optimizer did its job.

```text
your table ──fit──▶ fingerprint.dfp ──generate──▶ 10 rows … 10 million rows
                         │                               │
                         ├──compare──▶ drift report      └──validate──▶ evidence report
                         └──mutate / merge──▶ what-if scenarios
```

## Quickstart

```bash
pip install ectype-data
```

The package is published on PyPI as `ectype-data`. You import it as `ectype`, and the command is `ectype`.

```python
import polars as pl
import ectype

df = pl.read_csv("customers.csv")

fp = ectype.fit(df)                                  # learn the fingerprint, with the defaults
fp.save("customers.dfp")                             # a small file of statistics, no raw rows

synthetic = ectype.Generator.from_fingerprint("customers.dfp").generate(1_000_000, seed=42)

print(ectype.validate(fp, synthetic).summary())      # calibration | sealed | holdout, never merged
ectype.report(fp).to_html("profile.html")            # one page that describes the table
```

The defaults fit the closest model within a work budget. `ectype.fit(df, effort="fast")` fits
in the shortest time, and `effort="best"` fits in full however wide the table is.

Or with no code at all:

```bash
ectype profile customers.csv -o customers.dfp
ectype report customers.dfp -o profile.html          # the profile report
ectype generate customers.dfp --rows 1000000 -o synthetic.parquet
ectype validate customers.dfp synthetic.parquet --html report.html
```

The [Quickstart](docs/guide/02-quickstart.md) walks through the same loop on a sample table,
with every output shown.

## Features

<table>
<tr>
<td width="50%" valign="top">

### 🧬 A fingerprint, not a black box
- One portable `.dfp` file: JSON plus NumPy arrays plus checksums.
- **Loading never executes code.** No pickle and no `eval`; it fails closed on tampering and on
  oversized or malformed archives.
- Inspect it, diff it and keep it in version control.
- Read it as a one-page **profile report** (`ectype report`): every column, how columns move
  together and what the policy did, drawn from the fingerprint alone. Give it two fingerprints
  to see what drifted between them.
- A published JSON Schema, so any language can read it.

</td>
<td width="50%" valign="top">

### 🎯 Honest validation
- Targets are split into **calibration** (what the optimizer sees) and **sealed**
  (hash-committed evidence it never sees).
- An optional real **holdout** adds row-level checks, including nonlinear classifier
  two-sample tests.
- Reports never collapse into one flattering score.
- A shareable HTML report, plus exit codes for CI.

</td>
</tr>
<tr>
<td valign="top">

### 📈 Real statistical modeling
- Marginals selected by held-out fit (parametric families or policy-limited empirical).
- Mixed types, nulls and categories modeled jointly, with rank-matched latent correlations
  that stay accurate for tied and discrete data.
- A **chain model** of sequential conditional trees is the default, for the closest match;
  copula, mixture, vine and forest models are a keyword away, and `joint="auto"` compares
  them by measured fit. `effort="fast" | "balanced" | "best"` if you think in time, not models.
- **Conditional tables** for category-to-category structure, and an optional neural model for
  shapes a copula can't express.

</td>
<td valign="top">

### 🔒 Privacy by default
- Every fingerprint is fitted under a **disclosure policy** (`strict`, `standard` or
  `research`). The policy pools rare categories, coarsens quantiles and keeps exact extremes
  out of the fingerprint, even on small tables.
- Combinations of values held by fewer rows than the policy's minimum (10 under `standard`)
  are not stored, in pairwise tables or in the chain model's trees.
- Columns that look personal (names, phone numbers, e-mail and postal addresses) are
  **pseudonymised** by default: modeled as categories and generated as stand-in tokens, with no
  real value in the fingerprint or the output.
- Unique keys are regenerated in the same shape, never copied: an id, or a column with one
  e-mail address per row. Keys that point to another record (a parent
  record, an order number on its lines) come out as **fresh keys** with the source's repeat
  structure.
- A built-in **attack suite**: membership inference, distance-to-closest-record and attribute
  inference, gated against null distributions. Each is a screen with a stated detection limit:
  it shows a problem it can see, and is not proof that none exists.
- DP building blocks (analytic Gaussian mechanism) with a privacy-budget accountant.

</td>
</tr>
<tr>
<td valign="top">

### 📏 Rules your data obeys
- Declare constraints (`start <= end`) and derived columns (`total = qty * price`).
- Relationships found for you: dates that stay in order, weekday and year columns that agree
  with their date, parts that add up to their total, and working-week patterns.
- **Inferred constraints are suggestions** (bounds, comparisons between columns), with
  multiplicity-aware confidence; none binds until you confirm it. A relationship that holds
  on every row, such as a column computed from another, is applied for you and listed by
  `ectype inspect`.
- Generated values follow the fitted distribution, so a few can fall outside the observed
  range; declare a bound (`age <= 100`) to hold them inside one.
- Enforcement by derivation, rejection or repair, with exact row counts.
- **Calibration** corrects the distortion that enforcement introduces, and says so when a
  target can't be reached.

</td>
<td valign="top">

### 🕰️ Time, tables and scenarios
- **Time series:** trend, seasonality and AR models; **panels** of entities; **event** streams
  (Poisson and Hawkes processes).
- **Multi-table** schemas with 100% referential integrity.
- **What-if scenarios:** shift a mean, widen a spread, change category shares, add drift or
  mix populations, whatever the joint model. Setting a correlation directly takes a fingerprint
  fitted with `effort="fast"`.
- Scenarios are plain, reviewable requests, and each one reports what it achieved against
  what you asked for.

</td>
</tr>
<tr>
<td valign="top">

### 🔍 Drift detection
- Compare two fingerprints with no data and no generation, and pinpoint which columns and pairs
  moved.
- Comparisons fail closed: an inconclusive comparison never passes as "no drift".
- Drop `ectype compare --fail-on-drift` into CI to catch silent data changes.

</td>
<td valign="top">

### ⚙️ Built for real workflows
- A complete CLI and Python API.
- Read from CSV, Parquet, Arrow, pandas, Polars or **SQL through DuckDB**, with read-only
  guards.
- Out-of-core profiling with mergeable sketches, and parallel generation that is byte-identical
  to sequential.
- Fully local: no cloud, GPU or LLM required.

</td>
</tr>
</table>

## What people use it for

Anywhere real data is needed but hard to use: it is locked down, it holds personal details,
there is not enough of it, or it does not exist yet.

**By the job to be done**

| Job | Examples |
| --- | --- |
| Build and test software | Lifelike test databases, load tests at 100 times your volume, migration rehearsals, reproducible bug reports, test data in CI |
| Develop analytics and models | Prototype before access is granted, share a working sample with a vendor, tutorial data that runs for everyone |
| Share across a boundary | Between teams, with partners and auditors, with researchers and students, across regions where rows must stay put |
| Watch for change | Month-over-month drift checks, pipeline gates, acceptance checks on vendor deliveries |
| Explore what could happen | What-if scenarios, more of the rare cases, data for a table that does not exist yet |
| Teach, demonstrate and sell | Product demos, training environments, classroom datasets, hackathons |

**By industry**

| Industry | Examples |
| --- | --- |
| Banking and payments | Transactions for testing fraud rules; loan applications for credit-model development |
| Insurance | Policies and claims for pricing prototypes; shareable samples for reinsurers |
| Healthcare and life sciences | Encounter and claims tables for health IT testing; teaching datasets; trial-style tables |
| Retail and e-commerce | Orders, baskets and returns; store-by-day sales series for forecasting |
| Telecommunications | Usage records for billing tests; subscriber tables for churn analysis |
| Manufacturing | Sensor logs for maintenance software; inspection tables for quality dashboards |
| Energy and utilities | Meter readings for billing and forecasting; outage and work-order tables |
| Logistics and transportation | Shipments and delivery events; fleet and ridership tables |
| Government | Permits, inspections and service requests; shareable versions of administrative tables |
| Education and research | Course datasets; companion data for publications that cannot release the original |
| Human resources | Employee and payroll tables for software testing; workforce scenarios |
| Marketing and customer analytics | Campaign and survey tables for building reports before fieldwork ends |
| Software and SaaS | Seed data for demos, trials and sandboxes |
| Cybersecurity and IT operations | Log and event tables for testing detection rules; training exercises |
| Real estate and construction | Listings, permits and bids for analysis and estimating tools |
| Nonprofits and development | Beneficiary and survey tables for case-management tools and analyst training |

The **[full list](docs/use-cases.md)** has more examples for each, and the cases Ectype is not
designed for.

## How well does it work?

Closer to real data than every deep-learning synthesizer we tested, on a CPU, in seconds.

A head-to-head on nine public datasets with five seeds each: every method at its library
defaults, every score taken on held-out real rows that no method saw.

| Method | Classifier AUC (0.5 = cannot tell from real) | Mean rank | Quality | Utility kept | Worst-case membership AUC | Median fit |
| --- | --- | --- | --- | --- | --- | --- |
| Sequential trees (CART) | 0.596 | 1.1 | 0.980 | 98.3% | 0.533 | 2 s, CPU |
| **Ectype (chain model)** | **0.671** | **2.1** | **0.975** | **97.8%** | **0.505** | **10 s, CPU** |
| Diffusion (Synthcity TabDDPM) | 0.744 | 3.6 | 0.908 | 97.3% | 0.505 | 6.4 min, GPU |
| Deep autoregressive (MOSTLY AI SDK) | 0.790 | 3.9 | 0.966 | 96.3% | 0.507 | 2.3 min, GPU |
| Adversarial random forest (ARF) | 0.941 | 6.8 | 0.922 | 97.0% | 0.517 | 3.9 min, CPU |
| VAE (SDV TVAE) | 0.975 | 8.1 | 0.896 | 89.9% | 0.505 | 2.9 min, GPU |
| GAN (SDV CTGAN) | 0.976 | 8.1 | 0.882 | 88.5% | 0.505 | 6.5 min, GPU |
| Gaussian copula (SDV) | 0.994 | 9.3 | 0.869 | 86.8% | 0.506 | 6 s, CPU |

- **Second of ten methods** at passing for real data, and ahead of every deep-learning model
  tested.
- **97.8% of real-data predictive score kept** by models trained on Ectype's rows (median).
- **Membership-inference attacks score at chance:** at most 0.505 on any dataset, measured
  with a distance-based attack against held-out rows. Sequential
  trees rank first on fidelity by emitting values sampled from real rows, and they have the
  highest worst-case membership score of any method (0.533).
- **Beyond the benchmark:** run on 29 further public government, health and finance tables, from
  184 rows to 60,000-row samples and up to 287 columns, with no failures. It fits a
  2.4-million-row, 78-column table on a desktop CPU.

Every number, every method and every dataset, including where others lead, is in the
**[benchmark report](docs/results/compete.md)**. Ectype's chain model was tuned on two of the
nine datasets; the diffusion model failed on 2 of its 45 runs.

## Why Ectype?

| | Ectype |
| --- | --- |
| Saved model | A declarative `.dfp` file: inspectable, diffable, and safe to load (no code runs) |
| Fidelity evidence | Sealed targets the generator never saw, plus an optional real holdout, reported separately |
| Privacy | A disclosure policy on every fit, stand-ins for personal columns, and a built-in attack suite |
| Useful without generating | Profile reports and drift comparisons straight from the fingerprint |
| Rules | Declared or confirmed constraints hold on every generated row |
| Runs where | A laptop, CI or an air-gapped server: CPU only, no network |

## Install

```bash
pip install ectype-data                 # core: polars, numpy, scipy, pyarrow, pydantic
pip install "ectype-data[temporal]"     # time-series models
pip install "ectype-data[sql]"          # DuckDB sources
pip install "ectype-data[pandas]"       # pandas in and out
pip install "ectype-data[llm]"          # optional: draft scenarios from plain English
pip install "ectype-data[all]"          # all of the above
```

The PyPI name is `ectype-data`; the import name and the command are both `ectype`. Python
3.11, 3.12 and 3.13 on Linux, macOS and Windows. [Installation](docs/guide/01-installation.md)
has the details.

## Documentation

The **[user guide](docs/guide/README.md)** runs from installation and a five-minute
walkthrough to time series, multi-table data, privacy, drift checks in CI and the full CLI and
Python API reference. A test executes every example in the guide.

- [Using Ectype from an AI agent](docs/guide/19-agents-and-mcp.md): how an agent calls the
  library and the CLI from its shell, and `ectype-mcp`, the MCP server coming next as a
  separate package (tested with Claude Code)
- [Versions and compatibility](docs/guide/20-versions-and-compatibility.md): what a newer or
  older engine does with your fingerprints, and how version numbers move
- [Design document](docs/design.md): concepts, architecture and research plan
- [Format specification](docs/format/README.md): the `.dfp` container and manifest schema
- [Architecture decisions](docs/adr/)
- [Size, fidelity and leakage study](docs/results/frontier.md)

## Status

Version 0.2.0, covered by 3,384 automated tests, including one that
runs every example in the user guide. The fingerprint format is `0.5.0`, versioned separately
from the package: a newer engine reads every fingerprint written by an older one of the same
major format version, and the repository keeps a saved fingerprint of each released format
that every test run loads. [Versions and compatibility](docs/guide/20-versions-and-compatibility.md)
has the full set of promises.

## Contributing

Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md); contributors sign the
[CLA](CLA.md) on their first pull request. Three rules matter most:
- format changes need an ADR;
- no pickle or `eval`;
- fidelity claims must come from sealed targets or a real holdout.

## License

Licensed under [Apache-2.0](LICENSE). Copyright 2026 ZeroPoint Holdings LLC.
"Ectype" is a trademark of ZeroPoint Holdings LLC.
