hyperopt / hyperopt-sklearn

Hyper-parameter optimization for sklearn
hyperopt.github.io/hyperopt-sklearn
Other
1.59k stars 272 forks source link

We are getting a broken pipe error when trying to fit. Please find the whole traceback below #140

Open PhanindraPanthagani opened 5 years ago

PhanindraPanthagani commented 5 years ago

Using hpsklearn-0.0.3.Please help me resolve this estim is hyperopt_estimator(algo=<function suggest at 0x00000245464E8D08>, classifier=None, continuous_loss_fn=True, ex_preprocs=None, fit_increment=1, fit_increment_dump_filename=None, loss_fn=<function roclossfn at 0x000002453DF50EA0>, max_evals=30, preprocessing=None, refit=True, regressor=None, seed=3, space=<hyperopt.pyll.base.Apply object at 0x0000024549E041D0>, trial_timeout=180, use_partial_fit=False, verbose=True) 0%| | 0/1 [00:00<?, ?it/s, best loss: ?]


BrokenPipeError Traceback (most recent call last)

in 50 51 ---> 52 estim.fit(X_trainnp, y_trainnp) 53 54 ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hpsklearn\estimator.py in fit(self, X, y, EX_list, valid_size, n_folds, cv_shuffle, warm_start, random_state, weights) 781 increment = min(self.fit_increment, 782 adjusted_max_evals - len(self.trials.trials)) --> 783 fit_iter.send(increment) 784 if filename is not None: 785 with open(filename, 'wb') as dump_file: ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hpsklearn\estimator.py in fit_iter(self, X, y, EX_list, valid_size, n_folds, cv_shuffle, warm_start, random_state, weights, increment) 691 # so we notice them. 692 catch_eval_exceptions=False, --> 693 return_argmin=False, # -- in case no success so far 694 ) 695 else: ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hyperopt\fmin.py in fmin(fn, space, algo, max_evals, trials, rstate, allow_trials_fmin, pass_expr_memo_ctrl, catch_eval_exceptions, verbose, return_argmin, points_to_evaluate, max_queue_len, show_progressbar) 386 catch_eval_exceptions=catch_eval_exceptions, 387 return_argmin=return_argmin, --> 388 show_progressbar=show_progressbar, 389 ) 390 ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hyperopt\base.py in fmin(self, fn, space, algo, max_evals, rstate, verbose, pass_expr_memo_ctrl, catch_eval_exceptions, return_argmin, show_progressbar) 637 catch_eval_exceptions=catch_eval_exceptions, 638 return_argmin=return_argmin, --> 639 show_progressbar=show_progressbar) 640 641 ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hyperopt\fmin.py in fmin(fn, space, algo, max_evals, trials, rstate, allow_trials_fmin, pass_expr_memo_ctrl, catch_eval_exceptions, verbose, return_argmin, points_to_evaluate, max_queue_len, show_progressbar) 405 show_progressbar=show_progressbar) 406 rval.catch_eval_exceptions = catch_eval_exceptions --> 407 rval.exhaust() 408 if return_argmin: 409 return trials.argmin ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hyperopt\fmin.py in exhaust(self) 260 def exhaust(self): 261 n_done = len(self.trials) --> 262 self.run(self.max_evals - n_done, block_until_done=self.asynchronous) 263 self.trials.refresh() 264 return self ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hyperopt\fmin.py in run(self, N, block_until_done) 225 else: 226 # -- loop over trials and do the jobs directly --> 227 self.serial_evaluate() 228 229 try: ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hyperopt\fmin.py in serial_evaluate(self, N) 139 ctrl = base.Ctrl(self.trials, current_trial=trial) 140 try: --> 141 result = self.domain.evaluate(spec, ctrl) 142 except Exception as e: 143 logger.info('job exception: %s' % str(e)) ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hyperopt\base.py in evaluate(self, config, ctrl, attach_attachments) 842 memo=memo, 843 print_node_on_error=self.rec_eval_print_node_on_error) --> 844 rval = self.fn(pyll_rval) 845 846 if isinstance(rval, (float, int, np.number)): ~\AppData\Local\Continuum\anaconda3new\lib\site-packages\hpsklearn\estimator.py in fn_with_timeout(*args, **kwargs) 639 th = Process(target=partial(fn, best_loss=self._best_loss), 640 args=args, kwargs=kwargs) --> 641 th.start() 642 if conn1.poll(self.trial_timeout): 643 fn_rval = conn1.recv() ~\AppData\Local\Continuum\anaconda3new\lib\multiprocessing\process.py in start(self) 110 'daemonic processes are not allowed to have children' 111 _cleanup() --> 112 self._popen = self._Popen(self) 113 self._sentinel = self._popen.sentinel 114 # Avoid a refcycle if the target function holds an indirect ~\AppData\Local\Continuum\anaconda3new\lib\multiprocessing\context.py in _Popen(process_obj) 221 @staticmethod 222 def _Popen(process_obj): --> 223 return _default_context.get_context().Process._Popen(process_obj) 224 225 class DefaultContext(BaseContext): ~\AppData\Local\Continuum\anaconda3new\lib\multiprocessing\context.py in _Popen(process_obj) 320 def _Popen(process_obj): 321 from .popen_spawn_win32 import Popen --> 322 return Popen(process_obj) 323 324 class SpawnContext(BaseContext): ~\AppData\Local\Continuum\anaconda3new\lib\multiprocessing\popen_spawn_win32.py in __init__(self, process_obj) 87 try: 88 reduction.dump(prep_data, to_child) ---> 89 reduction.dump(process_obj, to_child) 90 finally: 91 set_spawning_popen(None) ~\AppData\Local\Continuum\anaconda3new\lib\multiprocessing\reduction.py in dump(obj, file, protocol) 58 def dump(obj, file, protocol=None): 59 '''Replacement for pickle.dump() using ForkingPickler.''' ---> 60 ForkingPickler(file, protocol).dump(obj) 61 62 # BrokenPipeError: [Errno 32] Broken pipe
bjkomer commented 4 years ago

Which operating system are you using? This sounds like it may be an issue with multiprocessing with Windows, related to #144

If so, the quickest solution to try is to wrap your code in a main function

def main():
   # your code here

if __name__ == '__main__':
    main()

Do you have a minimum code example of what is causing the issue?