When going through the
nbs lesson2_rf_interpretation
,
def get_preds(t): return t.predict(X_valid)
%time preds = np.stack(parallel_trees(m, get_preds))
np.mean(preds[:,0]), np.std(preds[:,0])
This code block generates these exceptions-:
Exception in thread Thread-41:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\ProgramData\Anaconda3\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "C:\ProgramData\Anaconda3\lib\concurrent\futures\process.py", line 295, in _queue_management_worker
shutdown_worker()
File "C:\ProgramData\Anaconda3\lib\concurrent\futures\process.py", line 253, in shutdown_worker
call_queue.put_nowait(None)
File "C:\ProgramData\Anaconda3\lib\multiprocessing\queues.py", line 129, in put_nowait
return self.put(obj, False)
File "C:\ProgramData\Anaconda3\lib\multiprocessing\queues.py", line 83, in put
raise Full
queue.Full
---------------------------------------------------------------------------
BrokenProcessPool Traceback (most recent call last)
<timed exec> in <module>()
D:\Github\fastai\courses\ml1\fastai\structured.py in parallel_trees(m, fn, n_jobs)
18
19 def parallel_trees(m, fn, n_jobs=8):
---> 20 return list(ProcessPoolExecutor(n_jobs).map(fn, m.estimators_))
21
22 def draw_tree(t, df, size=10, ratio=0.6, precision=0):
C:\ProgramData\Anaconda3\lib\concurrent\futures\process.py in _chain_from_iterable_of_lists(iterable)
364 careful not to keep references to yielded objects.
365 """
--> 366 for element in iterable:
367 element.reverse()
368 while element:
C:\ProgramData\Anaconda3\lib\concurrent\futures\_base.py in result_iterator()
584 # Careful not to keep a reference to the popped future
585 if timeout is None:
--> 586 yield fs.pop().result()
587 else:
588 yield fs.pop().result(end_time - time.time())
C:\ProgramData\Anaconda3\lib\concurrent\futures\_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
--> 432 return self.__get_result()
433 else:
434 raise TimeoutError()
C:\ProgramData\Anaconda3\lib\concurrent\futures\_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
Out[12]:
(10.392261561614122, 0.41180742095175948)