skorch icon indicating copy to clipboard operation
skorch copied to clipboard

Add notebook that shows how to use skorch with optuna

Open BenjaminBossan opened this issue 4 years ago • 3 comments

Fixes #718

This notebook shows how to use skorch in conjunction with optuna, which can be much more efficient than GridSearchCV or RandomizedSearchCV. I don't have a deep knowledge of optuna, so there may be room for improvement. The whole example is inspired by this one.

Right now, the implementation makes use of the skorch-internal train/valid split. This allows us to use optuna with very few lines of extra code.

Right now, this notebook contains an ad hoc implementation of an OptunaCallback, which is responsible for logging and pruning trials. Possibly, this could be extended for more functionality. If so, it could find it's way into the skorch code base.

Eventually, we could consider adding a section to the docs about hyper-parameter optimization using different libraries. WDYT?

BenjaminBossan avatar Nov 21 '20 17:11 BenjaminBossan

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Update: optuna already provides a skorch callback, which is almost exactly the same that I used. I changed the notebook to use this instead.

BenjaminBossan avatar Nov 22 '20 15:11 BenjaminBossan

@thomasjpfan I improved the notebook by adding more descriptions, as you correctly pointed out. Now it should be more accessible for users who don't already know optuna. Furthermore, I increased the image size, which was quite small originally.

BenjaminBossan avatar Nov 28 '20 18:11 BenjaminBossan

Closing this as it's super old :)

BenjaminBossan avatar Jul 04 '23 14:07 BenjaminBossan