gpt4 book ai didi

python - 任何 n_jobs 进行交叉验证的内存泄漏

转载 作者:行者123 更新时间:2023-12-03 20:53:08 25 4
gpt4 key购买 nike

我正在运行一个代码来进行二进制分类并在之后预测标签。该代码与一个大小为 257673 行和 47 列的特定数据库完美运行。当我尝试使用 91690 行和 10 列之一(当然更小)时,我收到错误调用:

TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker. The exit codes of the workers are {SIGKILL(-9)} 

我正在使用 cross validation线与 n_job=-1
cross_val_score(model, X.drop(target,axis=1), X[target], cv=outer_cv, n_jobs=-1, scoring='neg_mean_squared_error')

outer_cv = StratifiedKFold(n_splits=5, shuffle=True, random_state=1)
model是 sklearn 算法中的任何一种,我已经尝试过 AdaBoostClassifier、LogisticRegression、KNN、SVM、GradientBoosting、RandomForest、DecisionTreeClassifier……以及许多其他算法,但我一直遇到同样的错误。

我试过改变 n_jobs=-2, 1, 2并且错误仍然存​​在。我在 jupyter 笔记本上运行代码,我的笔记本具有以下属性:
Ubuntu 18.04.4 LTS
RAM: 15,5 Gb
Processor: Intel® Core™ i7-8550U CPU @ 1.80GHz × 8

我怎么能解决这个问题?

最佳答案

我找到了这个问题的答案。
似乎某些 scikit-learn 算法会根据分类特征的编码方法产生这些错误。就我而言,我不得不从我使用的算法列表中删除:CategoricalNB()、Ridge()、ElasticNet() 和 GaussianProcessClassifier(),因为它们使用 StandardScaler() 或 MinMaxScaler() 产生错误。

关于python - 任何 n_jobs 进行交叉验证的内存泄漏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61977316/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com