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

Add verbose option to TVAE #313

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jjmarks
Copy link

@jjmarks jjmarks commented Aug 19, 2023

Resolves #307.
Resolves #269.

Print reconstruction loss and KL divergence loss terms. Does not store values or use progress bar.

@jjmarks jjmarks requested a review from a team as a code owner August 19, 2023 21:55
@jjmarks jjmarks requested review from amontanez24 and removed request for a team August 19, 2023 21:55
@npatki
Copy link
Contributor

npatki commented Aug 21, 2023

Hi @jjmarks! Thanks for your interest in contributing to the SDV software. In order to review and approve your code changes, we require that you read and sign our new Contributor License Agreement (CLA).

To request a CLA, please fill out the required information in this form: https://bit.ly/sdv-cla-form

Once we receive your submission, we'll get back to you with more details. Thanks, and feel free to respond here if you have any questions.

@npatki
Copy link
Contributor

npatki commented Aug 22, 2023

Hi @jjmarks, this is just a confirmation that we've received your signed CLA. A member of the SDV team will now be able to review/merge your PR. Thanks!

@npatki npatki added the PR:CLA Approved The required CLA has been signed label Aug 22, 2023
@@ -110,6 +110,7 @@ def __init__(
decompress_dims=(128, 128),
l2scale=1e-5,
batch_size=500,
verbose=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add this parameter to the end? Just in case anybody is passing in all the parameters unnamed, we don't want the wrong values being passed to the wrong parameters

Copy link
Author

@jjmarks jjmarks Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be passed to the end, although this ordering is consistent with CTGAN class,

log_frequency=True, verbose=False, epochs=300, pac=10, cuda=True):

Would it be better to keep the two orderings consistent?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I guess it's fine to keep consistent.

Comment on lines +182 to +185
print(f'Epoch {i+1}, Loss: {loss.detach().cpu(): .4f},', # noqa: T001
f' Rec loss: {loss_1.detach().cpu(): .4f},',
f' KL loss: {loss_2.detach().cpu(): .4f}',
flush=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would you mind adding unit tests for this case? Just making sure the print out only happens when verbose is true and that the output is as expected

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Are there any active unit tests run for TVAE as a template? I see test_tvae.py but it looks like only placeholder comments.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately I don't think there are, although I think a PR with some should be coming in shortly. I would use the tests in this file as an example. I know the tests don't exist for the CTGAN verbose parameter, but we're trying to improve test coverage.

I think you can do something similar to this. Mock print and make sure it gets called with the correct string but only if verbose is True.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR:CLA Approved The required CLA has been signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking and Saving TVAE Loss Values Add verbose parameter to TVAE
3 participants