Added notebook for hierarchical sir model and AMR#620
Added notebook for hierarchical sir model and AMR#620
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
…eters by distribution parameter dependencies
…or alpha and concentration0 for beta
There was a problem hiding this comment.
Copilot reviewed 6 out of 10 changed files in this pull request and generated 4 comments.
Files not reviewed (4)
- docs/source/beta_mean_cycle_sir_model.json: Language not supported
- docs/source/beta_mean_gamma_cycle_sir_model.json: Language not supported
- docs/source/gamma_mean_beta_mean_cycle_sir_model.json: Language not supported
- docs/source/hierarchical_sir_model.json: Language not supported
Comments suppressed due to low confidence (5)
pyciemss/mira_integration/distributions.py:50
- Ensure that the function
safe_sympytorch_parse_expris covered by tests.
def safe_sympytorch_parse_expr(expr: SympyExprStr, local_dict: Optional[Dict[str, torch.Tensor]]) -> torch.Tensor:
pyciemss/mira_integration/compiled_dynamics.py:54
- Ensure that param_info is of a type that get_name can handle. Consider adding a type check before calling get_name.
param_name = get_name(param_info)
pyciemss/mira_integration/compiled_dynamics.py:126
- Ensure that param_info is correctly handled for different types in _compile_param_values_mira. Verify that the types are correctly processed for pyro.nn.PyroSample and pyro.nn.PyroParam.
param_info = src.parameters[param_name]
pyciemss/compiled_dynamics.py:24
- The assignment of 'params' is redundant and should be removed.
params = _compile_param_values(self.src)
pyciemss/compiled_dynamics.py:33
- Ensure that the 'get_name' function is correctly defined and used.
v = params[get_name(k)]
| ParameterDict = Dict[str, Union[torch.Tensor, SympyExprStr]] | ||
|
|
||
|
|
||
| @_sort_dependencies.register(mira.modeling.Model) |
There was a problem hiding this comment.
Redundant definition of sort_mira_dependencies found. This function is already defined in pyciemss/mira_integration/compiled_dynamics.py. Consider removing one of the definitions to avoid confusion.
| @_sort_dependencies.register(mira.modeling.Model) | |
| def safe_sympytorch_parse_expr(expr: SympyExprStr, local_dict: Optional[Dict[str, torch.Tensor]]) -> torch.Tensor: |
| expr : SympyExprStr | ||
| The sympy expression to convert to a PyTorch tensor. | ||
| local_dict : Optional[Dict] | ||
| A dictionary of free symbols and their variables to use in the sympy expression.""" |
There was a problem hiding this comment.
Incomplete docstring for safe_sympytorch_parse_expr. The closing triple quotes are misplaced.
| concentration = parameters["alpha"] | ||
| else: | ||
| raise ValueError( | ||
| "MIRA InverseGamma distribution requires 'shape' or 'concentration' or 'alphaparameter" |
There was a problem hiding this comment.
Typo in error message: 'alphaparameter' should be 'alpha parameter'.
| "MIRA InverseGamma distribution requires 'shape' or 'concentration' or 'alphaparameter" | |
| "MIRA InverseGamma distribution requires 'shape' or 'concentration' or 'alpha parameter'" |
| rate = parameters["beta"] | ||
| else: | ||
| raise ValueError( | ||
| "MIRA InverseGamma distribution requires 'rate' or 'scale' or 'beta' parameter") |
There was a problem hiding this comment.
Missing period at the end of the error message.
|
This has been on hold until we figure out how to resolve the infinite recursion that occurs when sampling from a PyroSample object. One possible solution is to run the sympytorch module individually on each variable in topological order. |
Uh oh!
There was an error while loading. Please reload this page.