Skip to main content

Autonomio

Chances turns declared random computations into checked arrays and repeatable research evidence.

OpenSSF Best Practices OpenSSF Scorecard PyPI version Chances documentation Master tests and builds

Chances — Scientific randomness

Scientific randomness from a declared protocol, with verifiable arrays and execution receipts.

Chances unifies distributions, resampling, allocation, and point designs through one seeded protocol. Declare the scientific decision, inspect it before drawing, and retain the result with the evidence needed to verify and repeat it.

What Chances Is Not

Chances owns generation, validation, archival integrity, and conditional exact replay. Researchers own the choice of distribution, resampling unit, experimental design, and interpretation. Chances does not infer those decisions or certify scientific suitability. It is not a cryptographic random generator or a physical entropy service. Core execution requires a seed, uses local generators, and leaves Python and NumPy global random state unchanged.

Capabilities

The catalog covers 19 operations and 132 distribution families.

Research task Supported capability
Draw from a scientific model Univariate and multivariate distributions, empirical samples, and mixtures
Resample observations Whole-row selection, permutations, bootstrap, and stratified splits
Plan a study or simulation Balanced allocation, antithetic pairs, and randomized or quasi Monte Carlo designs
Keep computations isolated Explicit seeds and named streams with isolated generators
Audit and repeat a result Validation before drawing, checked arrays, saved receipts, verification, and conditional exact replay

Use the operation catalog to select a family, its parameters, and its preconditions.

First successful computation

This README describes the 2.0 API in this repository. Historical 0.1 releases on PyPI use a different interface. Start from the current source checkout:

git clone https://github.com/autonomio/chances.git
cd chances
python -m pip install .

Use Python 3.10 or later. Installation supplies NumPy and SciPy; no optional runtime extras are required. Choose a new output directory for the example; existing destinations are rejected.

from pathlib import Path
import numpy as np
import chances

spec = {
    "version": 1,
    "operation": "normal",
    "parameters": {"size": 100, "loc": 0.0, "scale": 1.0},
    "randomness": {"seed": 42, "stream": "experiment/replicate-1"},
}
profile = chances.inspect(spec)
first = chances.generate(spec)
second = chances.generate(spec)
assert profile["output"]["shape"] == [100]
assert first.data.shape == (100,)
assert np.array_equal(first.data, second.data)
assert first.receipt == second.receipt

bundle = Path("first-batch")
first.write(bundle)
checked = chances.verify(bundle)
repeated = chances.replay(bundle)
assert np.array_equal(first.data, checked.data)
assert np.array_equal(first.data, repeated.data)
assert first.receipt == checked.receipt == repeated.receipt
assert {path.name for path in bundle.iterdir()} == {
    "data.npy", "recipe.json", "receipt.json"
}
print(first.data.shape)
print(bundle.resolve())

Expected result: (100,) and the absolute path of the retained first-batch directory. The array and receipt match across generation, verification, and replay in this environment. The example keeps those files for inspection.

inspect validates and describes without drawing randomness. generate returns data, a NumPy array, and receipt, JSON evidence. A stream name identifies one computation; declare different names for distinct replicates. See the specification contract for defaults and stream semantics.

Retain the evidence

File Retained evidence
data.npy Generated array
recipe.json Resolved scientific protocol
receipt.json Source, stream, engine state, implementation, environment, output identity, and mathematical checks
source.npy, when supplied Input observations in their declared order

The same bundle can be inspected from a shell or an agent through JSON commands:

python -m chances inspect first-batch/recipe.json
python -m chances verify first-batch
python -m chances replay first-batch

The reproducible batch guide covers the full archival workflow; the command-line reference defines arguments, JSON output, and structured failures.

Risk Boundary

Exact replay requires the recorded compatibility envelope. It does not promise equality across package versions, platforms, or changed chunk sizes. Unsigned receipts establish integrity relative to retained evidence; they do not establish authorship, independent samples, or the suitability of a statistical model. The receipt reference defines these boundaries and recovery from changed or incompatible evidence.

Choose the next task

Job Start here
Save, verify, and repeat a computation Reproducible batch
Resample aligned observations or partition strata Resampling
Retain point designs or treatment allocations Experimental design
Select a distribution and its parameters Operation catalog
Integrate Python or an agent Python API
Run JSON commands Command line
Replace a historical method Migration
Navigate the whole manual Documentation hub

Installed agents start at Path(chances.__file__).parent / "AGENTS.md"; the installed manual and catalogs live beside it under docs/. Structured ChancesError fields support recovery without substituting a method.

Contributing

Start with CONTRIBUTING.md and developer setup and validation. Propose work through Autonomio Chances issues.

Support

Use SUPPORT.md for bug reports, feature requests, and usage questions. Include a minimal protocol, Chances and Python versions, operating system, and the structured error. Use a small shareable fixture when a report needs source data.

Vulnerabilities

Report suspected vulnerabilities privately through GitHub Security Advisories. Use SECURITY.md for supported versions, response policy, and artifact verification. Do not report vulnerabilities through public issues.

Citations

Use CITATION.cff for software citation metadata. A reproducible research citation should identify Chances, its version, and the retained protocol and receipt. No DOI is supplied.

License

MIT License.

Metadata

Release files for chances 2.0.7

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

Source distribution (sdist)

Source distribution for chances 2.0.7
File Size Uploaded
chances-2.0.7.tar.gz 367.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chances 2.0.7
File Interpreter ABI Platform
chances-2.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 508.7 kB

Release files / chances-2.0.7.tar.gz

Download URL chances-2.0.7.tar.gz
Size 367.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9d54bb2228f4b1b05cc9323f68d141f1d3b5f1dab8ff8205509525c190c7553d
BLAKE2b-256 checksum
How to use checksums
21dbf47081e6757c8feb3bc00735068de84b2f2f41cc16b4f8ce8998c3dfd9e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / chances-2.0.7-py3-none-any.whl

Download URL chances-2.0.7-py3-none-any.whl
Size 141.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48a6659dcef55f57d1f59793c957fbe8006074d92ecadace652a198ee5954d41
BLAKE2b-256 checksum
How to use checksums
cdd250208d2b944d9abb394ee908c87d5841e95b106fa517237de2705ddcfb2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

2.0.8

2 release files

This release

2.0.7 This release

2 release files

0.1.9

2 release files

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.1

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