Как избежать ошибки 'A worker process managed by the executor was unexpectedly terminated' в GridSearchCV при n_jobs = -1
Для подборки параметров использую GridSearchCV. Код очень простой:
clf = RandomForestClassifier()
param_grid = {
'n_estimators': [100, 200],
'max_depth': [10, 50, 100],
'min_samples_split': [2, 4],
'max_features': ['sqrt', 'log2']
}
grid = GridSearchCV(clf, param_grid = param_grid, cv = 5, verbose = 5, n_jobs = -1)
grid.fit(X_train_t, y_train_t)
Проблема в том, что когда я запускаю код, получую ошибку:
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)}
Причной этого есть n_jobs = -1. Когда я использую n_jobs = 1, все работает и нет ошибки.
Как сделать так, чтобы код выполнялся при n_jobs = -1? Я хочу использовать все ядра для более быстрого обучения.
При использовании n_jobs = 1, боюсь, что мы будем учиться неделями :)
Спасибо)