I am running a long grid-search using sklearn
and I want to log all (emphasis all) console output to file. Running from terminal using >
and changing stdout to an open file etc. all work ... but only partially which is the accepted answer here. Anything called by print
does get saved to file, but not everything shown on console is saved. In particular for:
Fitting 5 folds for each of 128 candidates, totalling 640 fits
[Parallel(n_jobs=4)]: Done 42 tasks | elapsed: 2.7s
[Parallel(n_jobs=4)]: Done 192 tasks | elapsed: 12.3s
[Parallel(n_jobs=4)]: Done 442 tasks | elapsed: 35.1s
[Parallel(n_jobs=4)]: Done 640 out of 640 | elapsed: 55.7s finished
the first line does get saved to file. But the logging from [Parallel(n_jobs=4)]
is not saved. Instead:
Fitting 5 folds for each of 128 candidates, totalling 640 fits
{'estimator__max_depth': 5, 'estimator__min_samples_leaf': 4, 'estimator__min_samples_split': 8}
...
...
The second line is me simply printing best parameters obtained; everything from [Parallel(n_jobs=4)]
is lost. Does anyone know how to make this get saved to file also?