lnccbrown / lnccbrown/HSSM

Update docs/tutorials/main_tutorial.ipynb

Open
#661 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation
Dominant language
Python
Stars
124
Forks
24
Avg merge
19h 32m
Merged PRs (30d)
60

Description

Under the new registration paradigm, directly accessing configurations via `hssm.defaults.default_model_config["model_name"]` might not work if `"model_name"` is not _registered_ beforehand.

Relatedly, there are a few instances of data from this dict being pulled to build other objects:
```python
angle_loglik = make_likelihood_callable(
loglik="angle.onnx",
loglik_kind="approx_differentiable",
backend="jax",
params_is_reg=[0, 0, 0, 0, 0],
)

ANGLE = make_distribution(
"angle",
loglik=angle_loglik,
list_params=hssm.defaults.default_model_config["angle"]["list_params"], # to update
)
```
This would work is the model is already registered, but it might be better to use the new functions that render these objects:
```python
from hssm.defaults import get_angle_config
angle_list_params = get_angle_config()["list_params"] # new interface for defaults

angle_loglik = make_likelihood_callable(
loglik="angle.onnx",
loglik_kind="approx_differentiable",
backend="jax",
params_is_reg=[0, 0, 0, 0, 0],
)

ANGLE = make_distribution(
"angle",
loglik=angle_loglik,
list_params=angle_list_params,
)
```

After implementing #659, `default_model_config` _could_ be converted into a defaultdict leveraging this future functinality. However, this feels a bit too overengineered. It might just be better and simpler to use these new functions explicitly and hide `default_model_config`.

@AlexanderFengler @digicosmos86

Contributor guide

Open the contributing guide

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 docs/tutorials/main_tutorial.ipynb and search for direct accesses to hssm.defaults.default_model_config. Review the examples involving angle and replace those accesses with the corresponding new defaults functions, such as get_angle_config; done means the tutorial no longer relies on the old interface and its examples remain usable.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.