Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NotImplementedError in standard dataset #162

Closed
srnghn opened this issue Mar 25, 2020 · 5 comments
Closed

NotImplementedError in standard dataset #162

srnghn opened this issue Mar 25, 2020 · 5 comments

Comments

@srnghn
Copy link
Collaborator

srnghn commented Mar 25, 2020

Related to #109. Previously it warned Returning an ndarray, but in the future this will raise a 'NotImplementedError'. but now it returns the following error:

NotImplementedError                       Traceback (most recent call last)
<ipython-input-3-3996a519ec26> in <module>()
      1 from aif360.datasets import AdultDataset
----> 2 data = AdultDataset()

/Users/staceyro/anaconda/envs/aif360/lib/python3.7/site-packages/aif360/datasets/adult_dataset.py in __init__(self, label_name, favorable_classes, protected_attribute_names, privileged_classes, instance_weights_name, categorical_features, features_to_keep, features_to_drop, na_values, custom_preprocessing, metadata)
    110             features_to_keep=features_to_keep,
    111             features_to_drop=features_to_drop, na_values=na_values,
--> 112             custom_preprocessing=custom_preprocessing, metadata=metadata)

/Users/staceyro/anaconda/envs/aif360/lib/python3.7/site-packages/aif360/datasets/standard_dataset.py in __init__(self, df, label_name, favorable_classes, protected_attribute_names, privileged_classes, instance_weights_name, scores_name, categorical_features, features_to_keep, features_to_drop, na_values, custom_preprocessing, metadata)
    119             else:
    120                 # find all instances which match any of the attribute values
--> 121                 priv = np.logical_or.reduce(np.equal.outer(vals, df[attr]))
    122                 df.loc[priv, attr] = privileged_values[0]
    123                 df.loc[~priv, attr] = unprivileged_values[0]

/Users/staceyro/anaconda/envs/aif360/lib/python3.7/site-packages/pandas/core/series.py in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
    703             return None
    704         else:
--> 705             return construct_return(result)
    706 
    707     def __array__(self, dtype=None) -> np.ndarray:

/Users/staceyro/anaconda/envs/aif360/lib/python3.7/site-packages/pandas/core/series.py in construct_return(result)
    692                 if method == "outer":
    693                     # GH#27198
--> 694                     raise NotImplementedError
    695                 return result
    696             return self._constructor(result, index=index, name=name, copy=False)

NotImplementedError: 

Python: 3.7.2
Pandas: 1.0.3
AIF360: 0.2.3 (built from source)

To replicate:

import aif360
from aif360.datasets import AdultDataset
data = AdultDataset()
@nrkarthikeyan
Copy link
Collaborator

Hi @srnghn , the most recent master version (https://github.com/IBM/AIF360/blob/b3f589d3e87afc6ceb19646f426f09e695f81ea6/aif360/datasets/standard_dataset.py#L121) seems to have the fix for this. Can you please use the latest master and retry?

@srnghn
Copy link
Collaborator Author

srnghn commented Mar 25, 2020

Thanks @nrkarthikeyan, you're right. For some reason my build wasn't being recognised which is why I referred to aif360 version 0.2.3. I'm now using 0.2.2 from build and it runs as expected. When will this version be available with pip?

@nrkarthikeyan
Copy link
Collaborator

ok thanks @srnghn, I will close this issue now, and if you can reproduce the build error, please open a new one.

@hoffmansc
Copy link
Collaborator

When will this version be available with pip?

Soon! This really should have been included in 0.2.3 but that was an oversight, I guess. This will be in 0.3.0 which we're still finalizing, hence the delay. Sorry.

@autoih
Copy link
Contributor

autoih commented Mar 26, 2020

Thanks @srnghn, perhaps temporarily use the patch if the error exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants