pyGAM icon indicating copy to clipboard operation
pyGAM copied to clipboard

InvGaussDist.sample crashes when scale=None

Open Karman580 opened this issue 8 months ago • 0 comments

While testing the InvGaussDist distribution, I noticed that the sample method directly passes self.scale to numpy.random.wald. Since the default value of scale in InvGaussDist is None, this results in a runtime error because NumPy expects a numeric value.

Minimal Reproduction from pygam.distributions import InvGaussDist dist = InvGaussDist(scale=None) dist.sample(mu=1.0)

Error TypeError: must be real number, not NoneType Expected Behavior Sampling should work even when scale=None, similar to other distributions that fall back to a default scale (e.g., 1.0).

I’d be happy to work on a fix and submit a PR for this.

Karman580 avatar Mar 08 '26 18:03 Karman580