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.11

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.11
File Size Uploaded Provenance Actions
chances-2.0.11.tar.gz 406.5 kB Without provenance Details for chances-2.0.11.tar.gz

Built distribution (wheel)

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

Total release size: 552.9 kB

Release files / chances-2.0.11.tar.gz

Download URL chances-2.0.11.tar.gz
Size 406.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5f63ac0ed412bda6ade3c4a2e64aafc7e67413883b89cd604e331249f24b8497
BLAKE2b-256 checksum
How to use checksums
44843f40f734fb6af57c618d699628464ba80c21a2bf0d6dc83cc3466c648207
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.11-py3-none-any.whl

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

Security for chances 2.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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