Skip to content
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

Avoid warnings for jacobians close to zero in the corona model #138

Merged
merged 2 commits into from
Sep 8, 2024

Conversation

kaiserls
Copy link
Collaborator

@kaiserls kaiserls commented Sep 8, 2024

Description

The warning

The linear solver returned non-finite (NaN or inf) output. This usually means that the operator was not well-posed,
and that the solver does not support this. If you are trying solve a linear least-squares problem then you should pass
‘solver=AutoLinearSolver(well posed=False)‘. By default ‘lineax.linear solve‘ assumes that the operator is square
and nonsingular. If you *were* expecting this solver to work with this operator, then it may be because: (a) the operator
is singular, and your code has a bug; or (b) the operator was nearly singular (i.e. it had a high condition number:
‘jnp.linalg.cond(operator.as matrix())‘ is large), and the solver suffered from numerical instability issues; or (c) the
operator is declared to exhibit a certain property (e.g. positive definiteness) that is does not actually satisfy.

is generated by the package diffrax during the automatic differentiation of the ODE solution of the Corona model. It is generated when the Jacobian is close to zero, which leads to numerical problems. This pull request limits the parameter range of the Corona model and increases the solver accuracy to avoid this error. This change does not affect the inference quality, because the code treated these evaluations as a likelihood of 0 previously and the dropped parameter range is not essential to explain the data.\

Type of change

Please tick at least one of the options. Delete the other options.

  • Bug fix (non-breaking change which fixes an issue)

Checklist For Contributor

  • My code follows the style guidelines of this project (I installed pre-commit)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I wrote my changes in the changelog in the [unreleased] section
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Checklist For Maintainers

  • Continuous Integration (CI) is successfully running
  • Do we want to release/tag a new version? [✔️ / ❌]
    • If yes, add a release to the changelog and set the new version in pyproject.toml. After the merge, tag the release!

@kaiserls kaiserls merged commit fc78934 into main Sep 8, 2024
2 checks passed
@kaiserls kaiserls deleted the fix/corona_model_jacobian branch September 8, 2024 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant