6

Is it possible to print things or debug when using Parallel in a Jupyter notebook.

Here is my code

import pandas as pd
from sklearn.model_selection import ParameterGrid
from joblib import Parallel, delayed

def my_func(a,b):
    print("hi")
    return {"a":a,"b":b},a + b

grid = ParameterGrid({"a": [1, 2],
                      "b": [3, 4]})
resList = Parallel(n_jobs=-1)(delayed(my_func)(**params) for params in grid)
cols = ['params', 'results']
resDf = pd.DataFrame(resList,columns=cols)

The dataframe contains the correct results but the "hi" lines inside the function don't print

blissweb
  • 3,037
  • 3
  • 22
  • 33
  • Possible duplicate of https://stackoverflow.com/questions/55955330/printed-output-not-displayed-when-using-joblib-in-jupyter-notebook – Caleb Fenton Nov 06 '19 at 00:25

0 Answers0