-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data dictionary for each possible parameter to the model #291
Comments
I'd love for everything about a parameter to be in the same place (currently,
The descriptions could be then used to generate model documentation, and the shapes could be used for automatic validation. e.g.
You can probably do this with manual validations in the current system? Of course I'd prefer that this all be part of a real type system, but hey, Python |
This is a great idea, it also fits in with the efforts outlines in #180, it is likely worth it to specific attributes to the config class with pydoc comments, allowing api generation easily when #217 is tackled |
Meaning make parameters be attributes of an object? Or something else? A runtime type-ier version of this could be... from dynode.parameters import parameter, closed_interval
class ScenariosModelParameters(ModelParameters):
waning_protections: np.array = parameter(
description = "blah blah blah",
shape = lambda p: (p.num_waning_compartments,),
range: closed_interval(0.0, 1.0),
validation = lambda p: some_extra_validation(),
) I'm remembering my SQLAlchemy ORM here: https://docs.sqlalchemy.org/en/20/orm/quickstart.html |
Yeah something like this, this way when someone refers to a Config object they are able to get type hints and information about each parameter they can reference from it. Currently the code that adds attributes to Lines 33 to 57 in d2fb41f
specifically Line 54 in d2fb41f
is the main point in which all the keys in the JSON are added to the config. If we instead call a bunch of |
@edbaskerville and I had a separate conversation about using Chex as a parameters library since we are already using Jax in DynODE as a whole, leaving the link here for when this issue is taken on |
Just to clarify, the general idea is to use dataclasses as a convenient built-in notation for typed model parameters. chex implements a jax-compatible dataclass, but we wouldn't necessarily need to use it if it proves cumbersome--can always transform to something else at runtime. |
breakdown each accepted parameter for each configuration file (global, initializer, inferer). Make sure to include the definition, the accepted shape, what each dimension in the shape implies, and possibly downstream parameters that are automatically generated when that parameter is provided.
The text was updated successfully, but these errors were encountered: