Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output ELBO loss during calibrate #166

Closed
djinnome opened this issue Jun 1, 2023 · 3 comments
Closed

Output ELBO loss during calibrate #166

djinnome opened this issue Jun 1, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@djinnome
Copy link
Contributor

djinnome commented Jun 1, 2023

In PR #163 we discussed that it would be helpful for the user to view the convergence of the SVI algorithm.

Currently, calibrate prints out the loss every 25 iterations.

for i in range(num_iterations):
loss = svi.step(method=method)
if verbose:
if i % 25 == 0:
print(f"iteration {i}: loss = {loss}")

Joshua would like to capture this information either as an actual (optional) output, or as logging output so that it could be visualized as it is happening.

good convergence

image

bad convergence

image

WTF convergence

image

@djinnome djinnome assigned djinnome and JosephCottam and unassigned djinnome Jun 1, 2023
@djinnome
Copy link
Contributor Author

djinnome commented Jun 1, 2023

Hi Joseph, I assigned this to you because you may have opinions on whether it makes more sense to send the ELBO output to a logfile (for potential early stopping) or as an optional output of the calibrate function

@JosephCottam
Copy link
Contributor

This is case where I think we should do both:

  • If TA3 is interested in intermediate/live feedback, I think this is a good use-case and would pursue the "logging" option.
  • Returning it from the function is a useful piece for calibrating trust in the result.

From an implementation standpoint, if we are doing both, I woudl go about it like this:

  1. Create a file dedicated to the convergence data.
  2. Make that file name available some how so it can be monitored. (A RESTful way to do this would be to return a work ID as part of the response and have another query for "what is the log file associated with this work id". Its an extra round-trip, but it makes it easy to get at the file from more than one client.)
  3. Periodically write to the file.
  4. When work is done, return the file ID as part of the result.

This setup does require some persistent storage so that files outlive jobs, but it is usually simple to setup: add a file handle to existing print statements, thread that file handle through the calls.

(The convergence plots don't show for me...broken images. I think I remember the images from notebooks, though.)

@SamWitty SamWitty added the enhancement New feature or request label Dec 19, 2023
@SamWitty
Copy link
Contributor

Addressed by progress_hook in calibrate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants