Description
Ideally, I think, operations that take a lot of time should both:
- have a way of showing progress, and
- be interruptable.
It was previously discussed at least in #78, #7574, #7596.
Regarding progress, in #7574 @amueller proposed not bake progress bar in, but rather add callbacks. In #7596 @denis-bz suggested to have callbacks that are passed locals(), which is an interesting idea. I also saw that fit()
in GradientBoostingClassifier
has the monitor
parameter, which makes showing progress bars easy.
In #7596, @denis-bz suggested callbacks can also be used to interrupt computation. In our project, Orange (https://github.com/biolab/orange3), we do something similar: sometimes, where there is no other available mechanism, we raise a BaseException inside a callback to interrupt running threads.
Orange uses scikit-learn a lot and lack of callbacks in scikit-learn makes showing progress or interrupting hard (we'd like to allow stopping of running computations). For now, we have to resort to hacks. For example, inour Neural Network widget, we subclassed scikit-learn NNs and added a callback on n_iter_
change (biolab/orange3#2958)
We would like to help in implementing callbacks, but first, we are asking if you would even consider having something similar to GradientBoostingClassifier
monitor
in the other classes. What do you think?
Then, we could try thinking of an interface together and slowly start adding it to certain classed.