title: TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated
body: <p>I am trying to find optimal hyperparameters for my Deep learning model. When I used 'GridSearchCV' approach and tried fitting my model, I ended up with error </p>
  
  <blockquote>
    <p>"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 {EXIT(1)}"</p>
  </blockquote>
  
  <p>I have updated and tested scipy libraries, and that works fine.
  I can't use n_jobs=-1. I must use 1 upto 16 CPUs (n_jobs=16).</p>
  
  <p>My platform:
  NAME="Ubuntu"
  VERSION="16.04.6 LTS (Xenial Xerus)".
  I am accessing sklearn using conda 4.7.12 in python 3.6.9.
  We can't update Ubuntu at this time!</p>
  
  <pre><code>import pandas as pd
  import numpy
  import keras
  import scipy
  from keras.models import Sequential
  from keras.layers import Dense
  from keras.wrappers.scikit_learn import KerasClassifier
  from sklearn.model_selection import GridSearchCV
  from sklearn.model_selection import train_test_split
  from keras.optimizers import SGD
  from sklearn.externals import joblib
  from math import sqrt
  import tensorflow as tf
  from datetime import datetime
  
  
  # Make grid input
  batch_size  = [1644, 822, 548, 411, 328, 274, 234, 205, 182, 164]
  epochs = [10, 50, 100, 150, 200, 250, 300]
  learn_rate = [0.00001, 0.0001, 0.001, 0.01, 0.1, 0.2, 0.3]
  momentum = [0.0, 0.2, 0.4, 0.6, 0.8, 0.9]
  param_grid = dict(epochs = epochs, batch_size = batch_size, learn_rate=learn_rate, momentum=momentum)
  
  # Define model
  def get_compiled_model_advanced(learn_rate=learn_rate, momentum=momentum):
      model = tf.keras.Sequential([
          tf.keras.layers.Dense(200, activation='relu'),
          tf.keras.layers.Dense(50, activation='relu'),
          tf.keras.layers.Dense(10, activation='relu'),
          tf.keras.layers.Dense(1, activation='sigmoid')])
      # Compile model
      optimizer = SGD(lr=learn_rate, momentum=momentum, decay=0.5, nesterov=False)
      model.compile(optimizer=optimizer, loss='binary_crossentropy', metrics=['accuracy'])
      return model
  
  model_sgd = KerasClassifier(build_fn=get_compiled_model_advanced, verbose=0)
  
  grid_sgd = GridSearchCV(estimator = model_sgd, param_grid = param_grid, n_jobs = 16, verbose=0)
  sgd_fit = grid_sgd.fit(X, Y)
  </code></pre>
  
  <p>I would like to get my model running!
  Could someone tell me what am I doing wrong?</p>