lnccbrown / HSSM

Development of HSSM package
Other
72 stars 10 forks source link

`HSSM._postprocess_initvals_deterministic` breaks when the parameters have "_" (underscores) in the names #480

Closed krishnbera closed 5 days ago

krishnbera commented 1 week ago

Describe the bug HSSM._postprocess_initvals_deterministic breaks when the parameters have "_" (underscores) in the names.

HSSM version v0.2.2

To Reproduce Define a simple black-box model with a parameter that has "_" in the name.

model_config = {
        "list_params": ["_alpha"],
        "bounds": {
            "_alpha": (0, 1.0),
        },
    }

model = hssm.HSSM(
                data, 
                model='model1', 
                model_config=model_config,
                loglik=cython_logp_fn, 
                loglik_kind="blackbox",
                )

Additional context This needs to be handled in _get_prefix():

https://github.com/lnccbrown/HSSM/blob/6a11c4764834b2904b96e13e2c09bc99e3914ccb/src/hssm/hssm.py#L1751

AlexanderFengler commented 6 days ago

@krishnbera one option here would be to disallow this at the model_config? Do you need the _ prefix in the parameter name?

Or is this just an example and this comes up in other places randomly?

AlexanderFengler commented 5 days ago

@krishnbera ping

krishnbera commented 5 days ago

@krishnbera one option here would be to disallow this at the model_config? Do you need the _ prefix in the parameter name?

Or is this just an example and this comes up in other places randomly?

Yes, we can disallow _ in model_config, should not be a big deal since one can use .,etc in the parameter names. Closing this issue since it is not a bug (we can just specify this in the docs).