title: BrokenProcessPool on using n_jobs parameter in cross_val_score
body: <p>I'm getting error when using <code>n_jobs = -1</code> as a parameter in  <code>sklearn.model_selection.cross_val_score</code>. I'm a beginner in Deep Learning and ANN and as per the instructor in <a href="https://www.udemy.com/deeplearning/" rel="noreferrer">this</a> course in k-fold Cross-Validation, use <code>n_jobs = -1</code> to use all the processors of CPU so as to reduce the time but it's throwing an error in my case.</p>
  
  <p>Error -</p>
  
  <blockquote>
    <blockquote>
      <p>BrokenProcessPool: A task has failed to un-serialize. Please ensure that the arguments of the function are all picklable.</p>
    </blockquote>
  </blockquote>
  
  <p>Full stack trace can be found <a href="https://pastebin.com/wscHkN8H" rel="noreferrer">here</a>.</p>
  
  <pre><code>import keras
  from keras.wrappers.scikit_learn import KerasClassifier
  from sklearn.model_selection import cross_val_score
  def build_classifier():
      classifier = Sequential()
      classifier.add(Dense(units = 6, kernel_initializer = 'uniform', activation = 'relu', input_dim = 11))
      classifier.add(Dense(units = 6, kernel_initializer = 'uniform', activation = 'relu'))
      classifier.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid'))
      classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
      return classifier
  classifier = KerasClassifier(build_fn = build_classifier, batch_size = 10, nb_epoch = 100)
  accuracies = cross_val_score(estimator = classifier, X = X_train, y = Y_train, cv = 10, n_jobs = -1)
  </code></pre>