lnccbrown / lnccbrown/ssm-simulators

add_boundary leaves params/param_bounds inconsistent and validate_config passes it

Open
#308 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
24
Forks
18
Avg merge
1d 14h
Merged PRs (30d)
9

Description

ModelConfigBuilder.add_boundary records the new boundary's parameters in
boundary_params, but does not add them to params, param_bounds or
n_params. The resulting config simulates fine — the boundary parameter is
routed through boundary_params — but any consumer that reads the parameter box
never sees it.

validate_config(strict=True) reports the config as valid.

Reproducer
import numpy as np
from ssms.config import register_boundary
from ssms.config.model_config_builder import ModelConfigBuilder

def exp_collapse(t, a=1.0, rate=0.5):
    import numpy as np
    return a * np.exp(-rate * np.asarray(t))

register_boundary("exp_collapse", exp_collapse, ["a", "rate"])
cfg = ModelConfigBuilder.from_model("ddm")
cfg = ModelConfigBuilder.add_boundary(cfg, "exp_collapse", ["a", "rate"])

print("params         :", cfg["params"])
print("n_params       :", cfg["n_params"])
print("param_bounds w :", len(cfg["param_bounds"][0]))
print("boundary_params:", cfg["boundary_params"])
print("validate_config(strict=True) ->", ModelConfigBuilder.validate_config(cfg, strict=True))
params         : ['v', 'a', 'z', 't']          <- 'rate' absent
n_params       : 4                             <- still 4
param_bounds w : 4                             <- still 4
boundary_params: ['a', 'rate']
validate_config(strict=True) -> (True, [])
Why it matters

Simulator(model=cfg).simulate(theta={..., "rate": 0.7}) works, so this is easy
to miss. But param_bounds is what downstream code uses to derive priors and
LAN training ranges, so a boundary parameter added this way silently has no
bounds and no declared existence.

Possible fixes

Either have add_boundary extend params / param_bounds / n_params with the
new (non-a) boundary parameters, or have validate_config flag boundary/drift
parameters that are missing from params. The current combination — inconsistent
config that the validator passes — seems like the one option to avoid.

Version: ssm-simulators 0.13.2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ssms/config/model_config_builder.py at ModelConfigBuilder.add_boundary and validate_config, then run the supplied reproducer with the ssm-simulators 0.13.2 configuration. Trace how boundary_params, params, param_bounds, and n_params are assembled. Done means boundary parameters are represented consistently and strict validation no longer accepts a missing parameter declaration.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.