Skip to content

Try in Browser

The example below runs PyDSMC entirely in your browser. It uses marimo compiled to WebAssembly, so the Python code executes client-side via Pyodide.

What this demo does (and its limits)

Deep-learning frameworks such as PyTorch and Stable-Baselines3 are not available in WebAssembly, so this demo uses a tiny hand-coded CartPole controller instead of a trained neural agent. Everything else is the real PyDSMC: the same Evaluator, the same predefined return property, and the same statistical confidence interval you would get locally.

Locally you would instead pass a trained agent (or any predict_fn) and typically use more parallel environments. See Usage and Examples.

First run takes a few seconds

The first cell downloads and installs PyDSMC and its dependencies into the in-browser Python runtime. Give it a moment; subsequent runs are instant.

Live demo

The cell below is a live, editable notebook running entirely in your browser. On load it installs PyDSMC and statistically checks a hand-coded CartPole policy.

Edit it and run it

Click into the code, change something (e.g. epsilon for a tighter/looser confidence interval) or the policy itself; then click Run to rerun the code and see the estimates change.

Run it locally

Prefer to run on a real trained agent? Install PyDSMC and follow the Examples:

pip install "pydsmc"