Composable tools for quick Monte Carlo modelling and distribution elicitation.
Project description
drisk
Composable tools for quick Monte Carlo modelling, with an emphasis on distribution elicitation and model composition.
drisk provides a compact, notebook-friendly API for probability distributions,
elicitation workflows, correlated sampling, decision trees, sensitivity analysis, and
composable Monte Carlo models.
driskis currently in alpha. APIs may change before a stable release.
Links
- Documentation: https://nick-dorsch.github.io/drisk/
- Repository: https://github.com/nick-dorsch/drisk
- Issues: https://github.com/nick-dorsch/drisk/issues
Installation
Install from PyPI:
pip install drisk
Or with uv:
uv add drisk
drisk requires Python 3.12 or newer.
Quick start
import drisk as dr
# Elicit a distribution from intuitive inputs.
dist = dr.LogitNormal.elicit(low=0.1, high=0.25)
# Draw Monte Carlo samples.
samples = dist.sample(1_000)
Features
- Continuous distributions such as
Normal,LogNormal,LogitNormal,Beta,PERT,Gamma, andExponential - Discrete distributions such as
Bernoulli,Binomial,Poisson,Geometric, andNegativeBinomial - Distribution elicitation, fitting, sampling, plotting, and serialization-friendly parameters
- Mixture distributions with
UvMixture - Correlation matrix helpers and Gaussian / Student-t copulas
- Composable Monte Carlo models via
MCModel,MCOperation, andwhere - Decision tree modelling with chance, decision, and outcome nodes
- One-at-a-time sensitivity analysis helpers
Documentation
The documentation site includes examples and API reference pages:
https://nick-dorsch.github.io/drisk/
Developer setup
This repository uses:
- mise to install local development tools and run common project tasks
- uv for Python dependency management and command execution
1. Install tools with mise
Install mise if you do not already have it, then install the tools pinned in
.mise.toml:
mise install
This installs the project Python version, uv, ruff, and other helper tools for the
repository.
2. Install Python dependencies with uv
Sync the project environment from pyproject.toml and uv.lock:
uv sync --all-groups
Use uv run ... for commands that should execute inside the managed environment:
uv run pytest
uv run ruff check .
uv run python -c "import drisk as dr; print(dr.Normal.elicit(0, 1))"
When adding dependencies, use uv add so pyproject.toml and uv.lock stay in sync:
uv add numpy
uv add --dev pytest
uv add --group docs jupyter
3. Run project tasks with mise
List available tasks:
mise tasks
Common tasks:
mise run test # run the test suite
mise run lint # run ruff checks
mise run format # format the codebase
mise run check # run lint and tests
mise run docs # preview the Quarto documentation site
Project layout
src/drisk/
copulas/ # copula interfaces and implementations
correlations/ # correlation matrix helpers
decision/ # decision tree nodes, branches, and trees
distributions/ # distribution interfaces and implementations
models/ # composable Monte Carlo model helpers
sensitivity/ # sensitivity analysis utilities
arithmetic.py # arithmetic/composition helpers
random.py # seed/RNG helpers
summary.py # summary helpers
tests/ # pytest suite
docs/ # Quarto documentation site
License
drisk is distributed under the MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drisk-0.1.0.tar.gz.
File metadata
- Download URL: drisk-0.1.0.tar.gz
- Upload date:
- Size: 45.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
551c17d8b4bd2079aa4bb3dce4a23db0b35b454d292c0b0e085af3ef369dcc23
|
|
| MD5 |
ff084109e341e4482538d9b0dcecaaa5
|
|
| BLAKE2b-256 |
707752cccdf90577c4fdaf743c992e6bd85240aa0c17c7db95d9f325c97426d6
|
File details
Details for the file drisk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: drisk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 65.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51440ed45cbcf4fa50f42876717e58dc14a3e883c37ed9dacb5f65674553e58d
|
|
| MD5 |
1e998e97e8834778f58f10045d6a7692
|
|
| BLAKE2b-256 |
8887e2a88f66457167f51476547d968ee65c307cb01d106e79e0b1ac02b4c404
|