DataFrame对象不可使用AIF360调用



我遇到TypeError:"DataFrame"对象不可使用以下内容调用。有人能帮忙吗?谢谢

%cd -
dataset_orig = df_data_1(protected_attribute_names=['Gender'],
privileged_classes=['Male'],      
features_to_drop=[]) 
dataset_orig_train, dataset_orig_test = dataset_orig.split([0.7], shuffle=True)
privileged_groups = [{'Gender': 1}]
unprivileged_groups = [{'Gender': 0}]
/home/wsuser/work
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-59-8c624cfec261> in <module>
5 # consider in this evaluation
6 privileged_classes=['Male'],      # male is considered privileged
----> 7 features_to_drop=[]) # ignore all other attributes
8 
9 dataset_orig_train, dataset_orig_test = dataset_orig.split([0.7], shuffle=True)
TypeError: 'DataFrame' object is not callable

似乎df_data_1是您的数据集数据帧,对吗?如果是,您需要更新脚本,将其转换为StandardDataset:

from aif360.datasets import StandardDataset
dataset_orig = StandardDataset(df_data_1, 
protected_attribute_names=['Gender'],
privileged_classes=['Male'],
features_to_drop=[],
favorable_classes=[1]  # Update this with label values which are considered favorable in your dataset
) 

我不确定你的数据集是什么样子的,但你可以在这里调整完整的可复制示例,为你的数据集中做这个过程。

相关内容

  • 没有找到相关文章

最新更新