Skip to content

Overflows #46

@agucova

Description

@agucova

During testing of the correlations feature, I've noticed a bunch of distributions which casually produce overflows. Users wouldn't notice this except for infinities (np.inf) in their samples or distribution parameters.

I've fixed some of these (mostly those related to input parameters) alongside the distributions feature, but some that are still a problem:

  • LognormalDistribution:
    • Outcome: Infinities in distribution parameters.
    • To replicate: sq.lognorm(1,1e+26)
    • Location:
      self.lognorm_sd = (
      (np.exp(self.norm_sd**2) - 1) * np.exp(2 * self.norm_mean + self.norm_sd**2)
      ) ** 0.5
  • LogTDistribution:
    • Outcome: Infinities in samples.
    • To replicate: np.any(sq.log_t_sample(1.0, 2.0, 1, 100_000, 90) == np.inf)
    • Location:
      np.exp(
      normal_sample(mu, sigma, samples) / ((chi_square_sample(t, samples) / t) ** 0.5)
      )

I think it would be hard to fix this, most of these errors come from limitations inherent of the floating point operations; but I would at least try to reraise the warning as an error, to prevent users from creating models which might be silently wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions