# Buggy code
def _yield_sampler_checks(name, Estimator):
    yield check_target_type
    yield check_samplers_one_label
    yield check_samplers_fit
    yield check_samplers_fit_resample
    yield check_samplers_sampling_strategy_fit_resample
    yield check_samplers_sparse
    yield check_samplers_pandas
    yield check_samplers_multiclass_ova
    yield check_samplers_preserve_dtype
    yield check_samplers_sample_indices


# Traceback (TypeError)
TypeError                                 Traceback (most recent call last)
<ipython-input-51-da2a32d7cb52> in <module>()
----> pipe.fit(X_train, y_train)

10 frames
/usr/local/lib/python3.6/dist-packages/sklearn/model_selection/_search.py in fit(self, X, y, groups, **fit_params)
737             refit_start_time = time.time()
738             if y is not None:
--> 739                 self.best_estimator_.fit(X, y, **fit_params)
740             else:
741                 self.best_estimator_.fit(X, **fit_params)

/usr/local/lib/python3.6/dist-packages/imblearn/pipeline.py in fit(self, X, y, **fit_params)
285
286         """
--> 287         Xt, yt, fit_params = self._fit(X, y, **fit_params)
288         with _print_elapsed_time('Pipeline',
289                                  self._log_message(len(self.steps) - 1)):

/usr/local/lib/python3.6/dist-packages/imblearn/pipeline.py in _fit(self, X, y, **fit_params)
247                     message_clsname='Pipeline',
248                     message=self._log_message(step_idx),
--> 249                     **fit_params_steps[name]
250                 )
251             # Replace the transformer of the step with the fitted

/usr/local/lib/python3.6/dist-packages/joblib/memory.py in __call__(self, *args, **kwargs)
566
567     def __call__(self, *args, **kwargs):
--> 568         return self._cached_call(args, kwargs)[0]
569
570     def __getstate__(self):

/usr/local/lib/python3.6/dist-packages/joblib/memory.py in _cached_call(self, args, kwargs, shelving)
532
533         if must_call:
--> 534             out, metadata = self.call(*args, **kwargs)
535             if self.mmap_mode is not None:
536                 # Memmap the output at the first call to be consistent with

/usr/local/lib/python3.6/dist-packages/joblib/memory.py in call(self, *args, **kwargs)
732         if self._verbose > 0:
733             print(format_call(self.func, args, kwargs))
--> 734         output = self.func(*args, **kwargs)
735         self.store_backend.dump_item(
736             [func_id, args_id], output, verbose=self._verbose)

/usr/local/lib/python3.6/dist-packages/imblearn/pipeline.py in _fit_resample_one(sampler, X, y, message_clsname, message, **fit_params)
412                       **fit_params):
413     with _print_elapsed_time(message_clsname, message):
--> 414         X_res, y_res = sampler.fit_resample(X, y, **fit_params)
415
416         return X_res, y_res, sampler

/usr/local/lib/python3.6/dist-packages/imblearn/base.py in fit_resample(self, X, y)
79         )
80
---> 81         output = self._fit_resample(X, y)
82
83         if self._X_columns is not None or self._y_name is not None:

/usr/local/lib/python3.6/dist-packages/imblearn/over_sampling/_random_over_sampler.py in _fit_resample(self, X, y)
102     def _fit_resample(self, X, y):
103         random_state = check_random_state(self.random_state)
--> 104         target_stats = Counter(y)
105
106         sample_indices = range(X.shape[0])

/usr/lib/python3.6/collections/__init__.py in __init__(*args, **kwds)
533             raise TypeError('expected at most 1 arguments, got %d' % len(args))
534         super(Counter, self).__init__()
--> 535         self.update(*args, **kwds)
536
537     def __missing__(self, key):

/usr/lib/python3.6/collections/__init__.py in update(*args, **kwds)
620                     super(Counter, self).update(iterable) # fast path when counter is empty
621             else:
--> 622                 _count_elements(self, iterable)
623         if kwds:
624             self.update(kwds)

TypeError: unhashable type: 'numpy.ndarray'

# Fixed code
def _yield_sampler_checks(name, Estimator):
    yield check_target_type
    yield check_samplers_one_label
    yield check_samplers_fit
    yield check_samplers_fit_resample
    yield check_samplers_sampling_strategy_fit_resample
    yield check_samplers_sparse
    yield check_samplers_pandas
    yield check_samplers_multiclass_ova
    yield check_samplers_preserve_dtype
    yield check_samplers_sample_indices
    yield check_samplers_2d_target