我在修改IBM的AIF360包以解决数据中的偏见问题。我在Google Colab中使用命令!pip install aif360正确安装了该包,但在项目进行几天后,我遇到了下述错误,Google Colab无法识别我用来分析数据的数据集,为什么aif360包的安装程序不起作用,请问有什么建议吗?
# 我正在使用AIF 360dataset_orig = GermanDataset(protected_attribute_names=['age'],privileged_classes=[lambda x: x >= 25],features_to_drop=['personal_status', 'sex'] ) dataset_orig_train, dataset_orig_test = dataset_orig.split([0.7], shuffle=True)privileged_groups = [{'age': 1}]unprivileged_groups = [{'age': 0}]# 我遇到的错误IOError: [Errno 2] File /usr/local/lib/python3.6/dist-packages/aif360/datasets/../data/raw/german/german.data does not exist: '/usr/local/lib/python3.6/dist-packages/aif360/datasets/../data/raw/german/german.data'To use this class, please download the following files: https://archive.ics.uci.edu/ml/machine-learning-databases/statlog/german/german.data https://archive.ics.uci.edu/ml/machine-learning-databases/statlog/german/german.docand place them, as-is, in the folder: /usr/local/lib/python3.6/dist-packages/aif360/data/raw/germanAn exception has occurred, use %tb to see the full traceback.SystemExit: 1/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py:2890: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D. warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
回答:
这很简单。你只需要从以下链接下载这两个文件:
https://archive.ics.uci.edu/ml/machine-learning-databases/statlog/german/german.datahttps://archive.ics.uci.edu/ml/machine-learning-databases/statlog/german/german.doc
然后将它们放入文件夹’/usr/local/lib/python3.6/dist-packages/aif360/data/raw/German’中,并重新运行程序。它会运作得非常好 :).