jankrepl / deepdow

Portfolio optimization with deep learning.
https://deepdow.readthedocs.io
Apache License 2.0
903 stars 138 forks source link

tell the difference between saved model at checkpoint and best saved model? #85

Closed turmeric-blend closed 3 years ago

turmeric-blend commented 3 years ago

hi for the ModelCheckpointCallback, how do you tell the difference between saved model at checkpoint and best saved model?

Also, I noticed that save_best_only argument is not implemented in ModelCheckpointCallback?

https://github.com/jankrepl/deepdow/blob/f123a8212ab3b6a2ff8514dfd8b936bc47a8806d/deepdow/callbacks.py#L373

jankrepl commented 3 years ago

Really appreciate the question!

You are right, the save_best_only is never used anywhere! Cleary a bug:) Feel free to create a PR if you have some time, otherwise I can do it too. The quick fix is to simply delete this parameter.

Anyway, this callback will checkpoint the network each time a new minimum loss (metric) is reached under a different file. See the following line that determines the file name.

https://github.com/jankrepl/deepdow/blob/f123a8212ab3b6a2ff8514dfd8b936bc47a8806d/deepdow/callbacks.py#L410

TLDR; after training there will be multiple saved checkpoints in your checkpoint folder. To determine which one is the best one just take the one with the highest epoch (lowest loss function)