内核在 imblearn 的 SMOTE-NC 的 fit_resample 上崩溃

问题描述 投票:0回答:1

我有一个用于欺诈检测的数据集(我不能透露数据集),该数据集极其不平衡, 当我使用 SMOTE 时,一切正常,但由于我有 9 个分类特征,我想使用 SMOTE-NC,但当我运行 fit_resample 内核时,它就死掉了。

这是代码,X.shape 是 (2262378, 28),y.shape 是 (2262378,) 和

from imblearn.over_sampling import SMOTE ,SMOTENC

cat_cols = [x for x in cols1 if x in cols]

smote_cat = SMOTENC(random_state=42, categorical_features=cat_cols)
X_res, y_res = smote_cat.fit_resample(X, y)

我在配备 8GB RAM 的 M1 的 Macbook Air 上使用 vscode 和 conda 环境

pastebin 上我的 conda 要求.txt (https://pastebin.com/DRu4G2Sn)

我尝试通过关闭另一个应用程序来释放我的内存,重新启动笔记本电脑并以最少的数据使用量运行单元,它不起作用,内核仍然死机

python jupyter-notebook imbalanced-data imblearn
1个回答
0
投票

我使用两台不同的计算机(MacOS Intel 和 MacOS M1)。我在其中之一也有同样的问题。我意识到 imblearn 有不同的版本:0.11.o 和 0.12.2。这个问题出现在0.12中。我降级了版本,问题就消失了。

© www.soinside.com 2019 - 2024. All rights reserved.