Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ai-instructions
20 changes: 10 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
- '3.14'
steps:
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.5
- uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.68.1
pixi-version: v0.69.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: tests-cpu
Expand Down Expand Up @@ -57,9 +57,9 @@ jobs:
- '3.14'
steps:
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.5
- uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.68.1
pixi-version: v0.69.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: type-checking
Expand All @@ -80,9 +80,9 @@ jobs:
nvidia-smi
nvcc --version || echo "nvcc not found"
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.5
- uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.68.1
pixi-version: v0.69.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: tests-cuda12
Expand All @@ -99,9 +99,9 @@ jobs:
nvidia-smi
nvcc --version || echo "nvcc not found"
- uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.5
- uses: prefix-dev/setup-pixi@v0.9.6
with:
pixi-version: v0.68.1
pixi-version: v0.69.0
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
environments: tests-cuda12
Expand All @@ -114,9 +114,9 @@ jobs:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v6
# - uses: prefix-dev/setup-pixi@v0.9.5
# - uses: prefix-dev/setup-pixi@v0.9.6
# with:
# pixi-version: v0.68.1
# pixi-version: v0.69.0
# cache: true
# cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
# environments: tests-cpu
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.21.1
rev: v2.21.2
hooks:
- id: pyproject-fmt
- repo: https://github.com/lyz-code/yamlfix
Expand Down Expand Up @@ -54,7 +54,7 @@ repos:
hooks:
- id: check-github-workflows
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
rev: v0.15.14
hooks:
- id: ruff-check
args:
Expand Down
9 changes: 6 additions & 3 deletions docs/user_guide/pandas_interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ def is_good_health(health: DiscreteState) -> IntND:
return jnp.int32(health == Health.good)
```

## Validating Transition Probabilities
## Validating State Transition Probabilities

Check that a transition probability array has the correct shape, values in $[0, 1]$, and
rows that sum to 1:
Check that a state transition probability array has the correct shape, values in
$[0, 1]$, and rows that sum to 1:

```python
from lcm import validate_transition_probs
Expand All @@ -197,6 +197,9 @@ Raises `ValueError` if:

Call this after building the array to catch mistakes early.

Regime transition probabilities are validated automatically during `model.solve()` and
`model.simulate()`, so this helper covers only state transitions.

## Under the Hood

Internally, `solve()` and `simulate()` call `convert_series_in_params` (in
Expand Down
7 changes: 5 additions & 2 deletions src/lcm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@
_bind_forward_refs as _bind_persistence_forward_refs,
)
from lcm.simulation.result import SimulationResult # noqa: E402
from lcm.user_regime import MarkovTransition, Regime # noqa: E402
from lcm.user_regime import ( # noqa: E402
MarkovTransition,
Regime,
validate_transition_probs,
)
from lcm.utils.containers import invert_regime_ids # noqa: E402
from lcm.utils.error_handling import validate_transition_probs # noqa: E402
from lcm.variables import ( # noqa: E402
_bind_forward_refs as _bind_variables_forward_refs,
)
Expand Down
Loading
Loading