Skip to content

Remove jnp.nan in initial chains configuration #182

@ThibeauWouters

Description

@ThibeauWouters

In the current version of Jim, when calling sample in the Jim class, the initial positions of the chains are initialized by sampling from the prior if no initial_position was provided (which is usually the case). This is done by first setting all chain positions to NaN here. However, it would be best to avoid the deliberate use of NaN in the scripts since often, a bug in the program (e.g. issues with priors, likelihoods, transforms) manifests itself as NaNs in my experience. If the user wishes to use the JAX debugging NaN flag from this page, it will stop the execution of the script at this location and therefore prevent the user from locating the source of the actual, problematic NaN generation. I have verified that the jnp.nan could perfectly be replaced with jnp.inf and not change the execution of this function. While NaNs seem more commonly encountered in bugs when working with Jim than infs, this is perhaps not the most elegant solution, and it would be even better if we change the chains initialization in such a way to avoid using NaN and inf altogether in the chain initialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions