You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please indicate the following details about the environment in which you found the bug:
Copulas version: 0.4.0
Error Description
If ScipyModel subclasses are built using a dict specification that implies a constant value (such as scale=0), the constant value being passed is not properly restored, resulting on a model that samples None every time.
Steps to reproduce
To reproduce, a Univariate instance can be created passing a constant value specification, such as scale=0 on a GaussianUnivariate.
In [1]: from copulas.univariate import Univariate
In [2]: univariate = Univariate.from_dict({
...: 'type': 'copulas.univariate.gaussian.GaussianUnivariate',
...: 'loc': 10,
...: 'scale': 0
...: })
In [3]: univariate.sample(5)
Out[3]: array([None, None, None, None, None], dtype=object)
Fix
To fix this, a new method _extract_constant can be added to the ScipyModel subclasses which extracts the constant value encoded in the params and returns it, and then _set_constant_value must be used instead of _replace_constant_methods
The text was updated successfully, but these errors were encountered:
csala
added
the
bug
There is an error in the code that needs to be fixed
label
Feb 23, 2021
Environment Details
Please indicate the following details about the environment in which you found the bug:
Error Description
If ScipyModel subclasses are built using a dict specification that implies a constant value (such as
scale=0
), the constant value being passed is not properly restored, resulting on a model that samplesNone
every time.Steps to reproduce
To reproduce, a Univariate instance can be created passing a constant value specification, such as
scale=0
on aGaussianUnivariate
.Fix
To fix this, a new method
_extract_constant
can be added to theScipyModel
subclasses which extracts the constant value encoded in the params and returns it, and then_set_constant_value
must be used instead of_replace_constant_methods
The text was updated successfully, but these errors were encountered: