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
When the transformer is fitted, one of the intervals takes np.nan as the key, so later on np.nan can be properly transformed.
However, if the transformer is pickled and unpickled, the nan value that ends up being used as the key for the intervals dictionary is a different float('nan') instances, which prevents the transformer from being able to transform a np.nan value.
The CategoricalTransformer becomes unusable after being pickled and unpickled if it had
NaN
values in the data which it was fit on.The problem seems to come from this line:
RDT/rdt/transformers/categorical.py
Line 103 in cf62cc3
When the transformer is fitted, one of the
intervals
takesnp.nan
as the key, so later onnp.nan
can be properly transformed.However, if the transformer is pickled and unpickled, the
nan
value that ends up being used as thekey
for theintervals
dictionary is a differentfloat('nan')
instances, which prevents the transformer from being able totransform
anp.nan
value.Here is a snippet reproducing the issue:
To fix this, we can add a
__setstate__
method to theCategoricalTransformer
to replace anynull
key by the actualnp.nan
instance:The text was updated successfully, but these errors were encountered: