Skip to main content

PyRevealed

Rationality scores for every user, at scale. Rust engine, Python interface.

PyPI Documentation License: MIT

pip install pyrevealed

Quick Example

Score how consistently each user's choices align with rational utility maximization. Paste and run:

from pyrevealed.datasets import load_demo
from pyrevealed.engine import Engine

users = load_demo()  # 100 synthetic consumers, no download needed
engine = Engine(metrics=["garp", "ccei", "mpi", "harp", "hm"])
results = engine.analyze_arrays(users)

for r in results[:5]:
    print(r)
EngineResult: [+] GARP-consistent  ccei=1.0000  hm=15/15  (42us)
EngineResult: [-] 3 violations  ccei=0.8472  mpi=0.0231  hm=12/15  (38us)
EngineResult: [+] GARP-consistent  ccei=1.0000  hm=15/15  (35us)
...

Every score is a feature. Use them for fraud detection, user segmentation, A/B testing, churn prediction, or personalization.

Scores

Score Field What it measures Range
Consistency is_garp Are choices rationalizable? (GARP) bool
Efficiency ccei How close to perfectly rational? (Afriat) 0-1
Exploitability mpi Value left on the table per choice (Karp cycle) 0-1
Homotheticity is_harp Do preferences scale with budget? bool
Noise fraction hm_consistent/hm_total Fraction of rationalizable choices (Houtman-Maks) 0-1
Utility recovery utility_success Can latent utility be reconstructed? (Afriat LP) bool
Per-obs efficiency vei_mean Average efficiency across observations (Varian) 0-1

Which API?

Engine Function API
Use case Score thousands of users Deep-dive one user
Speed 10,000+ users/sec (Rust) Single-user
Returns EngineResult (flat scores) GARPResult, AEIResult, etc. (matrices, cycles, graphs)
Metrics 7 (garp, ccei, mpi, harp, hm, utility, vei) 30+ algorithms
Input list[(prices, quantities)] BehaviorLog

Engine for batch scoring. Function API when you need violation details, preference graphs, or advanced tests:

from pyrevealed import BehaviorLog, validate_consistency, compute_integrity_score
session = BehaviorLog(cost_vectors=prices, action_vectors=quantities)
garp = validate_consistency(session)       # GARPResult with violation cycles, matrices
ccei = compute_integrity_score(session)    # AEIResult with binary search details

4 Choice Categories

                Test (bool)     Score (0-1)     Recover (vector)  Structure (bool)
Budget          GARP, WARP      CCEI, MPI, HM   Utility, CV/EV    HARP, Separability
Discrete        SARP, RUM LP    HM (menu)        Ordinal utility   Congruence
Production      Prod GARP       Prod CCEI        Tech efficiency   Cost minimization
Intertemporal   Exp discount    —                Discount delta    Quasi-hyperbolic
Category Input format Example domain
Budget (prices T×K, quantities T×K) E-commerce, grocery, food delivery
Discrete (menus, choices) or (menus, frequencies) Surveys, A/B tests, recommendations
Production (input_p, input_q, output_p, output_q) Supply chain, manufacturing
Intertemporal (amounts, dates, chosen) Subscriptions, savings, loyalty

Performance

The Rust engine (rpt-core) handles graph algorithms and LP solving via Rayon thread pool. Python handles I/O and the user-facing API.

Users Metrics Time Throughput
1,000 5 0.1s 10,000/s
10,000 5 2s 5,000/s
100,000 5 20s 5,000/s

18-100x faster than pure Python. Memory stays bounded via streaming chunks.

Documentation

Full docs — tutorials, theory, API reference, application examples.

License

MIT

Metadata

Release files for pyrevealed 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrevealed 0.5.3
File Size Uploaded
pyrevealed-0.5.3.tar.gz 322.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pyrevealed 0.5.3
File
pyrevealed-0.5.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pyrevealed-0.5.3-cp313-cp313-manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64 Details
pyrevealed-0.5.3-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
pyrevealed-0.5.3-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
pyrevealed-0.5.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pyrevealed-0.5.3-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
pyrevealed-0.5.3-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
pyrevealed-0.5.3-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
pyrevealed-0.5.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pyrevealed-0.5.3-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
pyrevealed-0.5.3-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
pyrevealed-0.5.3-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
pyrevealed-0.5.3-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pyrevealed-0.5.3-cp310-cp310-manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64 Details
pyrevealed-0.5.3-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
pyrevealed-0.5.3-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details

Total release size: 36.8 MB

Release files / pyrevealed-0.5.3.tar.gz

Download URL pyrevealed-0.5.3.tar.gz
Size 322.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ce77a3bc570e8c9027faf91d92372a8bcaf8d26d74f3abf5e6c9ea6723c05e11
BLAKE2b-256 checksum
How to use checksums
290614c36c7fe7755f9325da878554b7c52dc9d8818c36c388d29031077117d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp313-cp313-win_amd64.whl

Download URL pyrevealed-0.5.3-cp313-cp313-win_amd64.whl
Size 2.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
015688fdb4305e78a3e3b45fc0c17d79535d3b31bbdd37193966805dc8794a73
BLAKE2b-256 checksum
How to use checksums
5922ad2c53608902c3ffd05ab113d5bfb82143de83b977ca2710e468d20e9851
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp313-cp313-manylinux_2_28_x86_64.whl

Download URL pyrevealed-0.5.3-cp313-cp313-manylinux_2_28_x86_64.whl
Size 2.7 MB
Tags CPython 3.13 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
97fbbf00084c8e47a581e58bf2667b959bcfd334ed2433c5142f2f236f7a0e46
BLAKE2b-256 checksum
How to use checksums
6c787a5f4a0e64ec75e5e1083a1a8f01429e9cc7cbddc5fb939921ac8b98e029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp313-cp313-macosx_11_0_arm64.whl

Download URL pyrevealed-0.5.3-cp313-cp313-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d49856b7d16c6aeafe0fd22dc6f140786937802c2240d84478a9070f2cc4e22d
BLAKE2b-256 checksum
How to use checksums
1b13e78973b9c7b67d1b72095d49a17bf3044086f46c6810fb9b91d30ae5fec9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp313-cp313-macosx_10_12_x86_64.whl

Download URL pyrevealed-0.5.3-cp313-cp313-macosx_10_12_x86_64.whl
Size 2.3 MB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8f4fd64ea1cf627a41b3ba96a55f684ee5170b6d9fb8b87a7e91e735ee8d6565
BLAKE2b-256 checksum
How to use checksums
9d3270cf2bd1f3560cffaffa988d77176b7ef7296a1de6073f20afa948232ae7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp312-cp312-win_amd64.whl

Download URL pyrevealed-0.5.3-cp312-cp312-win_amd64.whl
Size 2.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
715bba77ab889a2ac16389766ed8f899a34cd6d89feac8cef146a520b8d2ad54
BLAKE2b-256 checksum
How to use checksums
23b7236a14f16b4478fd565ebd31d7a9004ba8bd797d93e217dba235ba61953c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL pyrevealed-0.5.3-cp312-cp312-manylinux_2_28_x86_64.whl
Size 2.7 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
8afcb521ebcd7a4e0d81b4eeec2b3392308a816004ea287d4e4f360647da2d45
BLAKE2b-256 checksum
How to use checksums
5fe80ace4d27e36520a00cfd7bd1c06e81e72fc820285fa8e3936a49ae08a878
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp312-cp312-macosx_11_0_arm64.whl

Download URL pyrevealed-0.5.3-cp312-cp312-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
faa67000d3f8930a772fe34b76f8bfaa250f97b9eefb3fbf199b322fb44ef47e
BLAKE2b-256 checksum
How to use checksums
2c9a4c7c409f0b43429f8f85e6887deac70abd3bb77bc066a497fa861e20b164
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp312-cp312-macosx_10_12_x86_64.whl

Download URL pyrevealed-0.5.3-cp312-cp312-macosx_10_12_x86_64.whl
Size 2.3 MB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
aad78cf5164fd80fcd65da0a4a23676fcf418314e8840f35850fc2bacb4c5330
BLAKE2b-256 checksum
How to use checksums
c5bd7694d4839d7447e6bffbda4408bf2ac3b9271497c14d2705950cdc0d43d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp311-cp311-win_amd64.whl

Download URL pyrevealed-0.5.3-cp311-cp311-win_amd64.whl
Size 2.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
66af874ec683ffb964b757e81ad0b8cb452b38a378175215f27b132ccdd79321
BLAKE2b-256 checksum
How to use checksums
8096e8170ff6b69612bc48223f8c56e6d1d1799678c7b2917dbda2af453f5cbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL pyrevealed-0.5.3-cp311-cp311-manylinux_2_28_x86_64.whl
Size 2.7 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
2aa48dfa7a85f93525b908b1c15805614a672108cab7ee204677c8726ca81ff0
BLAKE2b-256 checksum
How to use checksums
c05f035b66845ad19ef91b7510d9497b83c5fdc1ef23e10c971815cc934a8f71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp311-cp311-macosx_11_0_arm64.whl

Download URL pyrevealed-0.5.3-cp311-cp311-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c49773a53fb73c3c602f43023764aeb066e75e16c8428b856a493506985e79fd
BLAKE2b-256 checksum
How to use checksums
419bffa4c195ddb7f846b5cf1fb002094e03615e8738ef1c8884e5acce582b31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp311-cp311-macosx_10_12_x86_64.whl

Download URL pyrevealed-0.5.3-cp311-cp311-macosx_10_12_x86_64.whl
Size 2.3 MB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d6a67f9a1e643782dc15f2da36664231a48503279cd7a581d543bb10d36651a8
BLAKE2b-256 checksum
How to use checksums
4fd9eab741a20b1f39a9d688973c88044201a7211c1f6d26367f004d72ea8e3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp310-cp310-win_amd64.whl

Download URL pyrevealed-0.5.3-cp310-cp310-win_amd64.whl
Size 2.0 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
acf332a94d790c608dd813c003495e6a5a24f36b74be3eab8e2ed76b56f44f9d
BLAKE2b-256 checksum
How to use checksums
9f985c4fa42eed662bc8edcf915d2315d3b3e3719e1bc0175ef1d54fee5dfb5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp310-cp310-manylinux_2_28_x86_64.whl

Download URL pyrevealed-0.5.3-cp310-cp310-manylinux_2_28_x86_64.whl
Size 2.7 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ecdac3752ae2210b92cef79ea72a190e9712a6af393ef4a14fa45c0ce4ebd2bd
BLAKE2b-256 checksum
How to use checksums
b2a7b13853dfd0b8ca38ca6ec8852677986534457940109600d531b846a7aa97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp310-cp310-macosx_11_0_arm64.whl

Download URL pyrevealed-0.5.3-cp310-cp310-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4e30a57edf6fc530e1844addfc53262dc6ccf3ee51cc471b32339b828c93ca3f
BLAKE2b-256 checksum
How to use checksums
e3923a61bb74e5a190c793edb936ba1879c5e1f73e21fcfa429f14a9af06cbeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release files / pyrevealed-0.5.3-cp310-cp310-macosx_10_12_x86_64.whl

Download URL pyrevealed-0.5.3-cp310-cp310-macosx_10_12_x86_64.whl
Size 2.3 MB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
701d5af6190bdd16c6bd48c265a663e084838a76402fc127df7538dcb54501e0
BLAKE2b-256 checksum
How to use checksums
6b9f030847de1141b9461e7e5b19d9c16353da1b93abe3f8d4bece968bd6433a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via maturin/1.12.6

Release history Release notifications | RSS feed

This release

0.5.3 This release

17 release files

0.5.2

2 release files

0.5.1

13 release files

0.5.0

1 release file

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page