gugarosa/learnergy

how to connect model.fit() to convergence.plot()?

bhomass opened this issue · 1 comments

Pre-checkings

  • [ x] Check that you are up-to-date with the master branch of Learnergy. You can update with:
    pip install git+git://github.com/gugarosa/learnergy.git --upgrade --no-deps

  • [ x] Check that you have read all of our README.

Description

I see the convergence.plot sample code, where you input a static dictionary of the values to be plotted. They are mse, pl and times.
In the gaussian_rbm.fit() method, you did a self.dump() for each epoch, but that only updates an internal structure. And then there is the logging. The fit() call would only return the cumulative mse and pl at the end of all epoch runs. So if you would like to see the convergence rate from epoch to epoch, I can't figure out how you intend to feed the training parameters to the plot routine.

Steps to Reproduce

  1. call a model.fit()
  2. insert some kind of hook to retrieve the mse and pl per epoch
  3. plot those results using convergence.plot()

please explain or give an example how to create such a hook.

Hello @bhomass! Sorry for the late response.

You can use something like this script: https://github.com/gugarosa/learnergy/blob/master/examples/visual/plot_metrics_convergence.py.

All internal models have an extra history attribute, which is always available when training them. Additionally, when they are saved, they are incorporated in the PyTorch file.

Best regards,
Gustavo.