Skip to content
Open
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
22 changes: 11 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Ancillary parameter dependencies, declaration side: every
- Ancillary parameter dependencies: every
`AbstractStateModel` and `AbstractObservationModel` now carries a
`depends_on` field (default `nothing`). Setting it to a `NamedTuple` of
per-trial label vectors — e.g. `obs_model.depends_on = (C = session, d =
Expand Down Expand Up @@ -37,12 +37,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
with the new exported `group_labels(model, name)` and
`group_parameter(model, name, label)`
* `show` reports the declared groups for a model that has any
* Honoured by the **Gaussian LDS** and the **Poisson LDS** across `fit!`,
`smooth`, `elbo`, `loglikelihood` and `rand`, each of which also accepts a
`depends_on` keyword overriding the model's stored labels so a held-out set
with a different trial count can be scored without mutating the model. All
versions of a parameter share the model's prior; each version contributes
its own log-prior term to the ELBO
* Supported for the **Gaussian LDS**, the **Poisson LDS** and the **SLDS**
across `fit!`, `smooth`, `elbo`, `loglikelihood` and `rand`, each of which
also accepts a `depends_on` keyword overriding the model's stored labels so
a held-out set with a different trial count can be scored without mutating
the model. All versions of a parameter share the model's prior; each
version contributes its own log-prior term to the ELBO
* The efficiency of same-length epochs is preserved *within* each group:
trials sharing every parameter form a cell, and the smoothed covariance is
computed once per cell and shared across it (parameters differ between
Expand All @@ -53,10 +53,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* For the Poisson emission there is no sufficient-statistic form, so the
M-step runs one LBFGS solve per version of `[C d D]`, over the trials of
every cell that shares that version
* **The SLDS is not wired up yet.** Its grouped E/M-step lands in a
follow-up; until then its `fit!`, `elbo` and `rand` throw an
`ArgumentError` on a model that declares `depends_on` rather than silently
fitting one pooled parameter set
* For an `SLDS` every regime must declare the same labels — the trial
partition is a property of the data, not of a regime — and mismatched
declarations raise an `ArgumentError`; `x0`/`P0` stay tied across regimes
as they are for an ungrouped SLDS
* With `depends_on` unset, every entry point takes its original code path
* A regression pooled over groups whose noise covariance differs — `(R =
session,)` with one emission over every session, or `(Q = session,)` with
Expand Down
7 changes: 6 additions & 1 deletion docs/src/LinearDynamicalSystems.md
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ ll = loglikelihood(lds, Y_test; depends_on = (C = session_test, d=session_test,
An override re-assigns trials to groups the model already declares; it cannot
introduce a new parameter set.

### Priors and cost
### Priors, SLDS, and cost

All versions of a parameter share the model's prior (`Q_prior`, `R_prior`,
`CD_prior`, …), and each version contributes its own log-prior term to the
Expand All @@ -454,6 +454,11 @@ runs one LBFGS solve per version of `[C d D]`, over the trials of every group
that shares that version; the state side flows through the pooled sufficient
statistics exactly as in the Gaussian case.

An `SLDS` supports the same field on each regime's sub-models. The grouping of
trials is a property of the data, so every regime must declare the same labels;
only the fitted values differ per regime. `x0` and `P0` stay tied across
regimes, as they are for an ungrouped SLDS.

Grouping does not give up the efficiency of equal-length epochs. Trials that
share every parameter form a *cell*, and the smoother computes one covariance
per cell and shares it across that cell's trials, exactly as it does across all
Expand Down
Loading
Loading