我遇到了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发布于 2021-09-21 17:54:35
看起来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
) 我不确定您的数据集是什么样子,但您可以调整完整的可重现示例here来为您的数据集执行此过程。
https://stackoverflow.com/questions/67197907
复制相似问题