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

Silent mode when creating reports. #269

Closed
alejandrofdez-us opened this issue Nov 19, 2022 · 5 comments · Fixed by #295
Closed

Silent mode when creating reports. #269

alejandrofdez-us opened this issue Nov 19, 2022 · 5 comments · Fixed by #295
Labels
feature:reports Related to any of the generated reports feature request Request for a new feature
Milestone

Comments

@alejandrofdez-us
Copy link

alejandrofdez-us commented Nov 19, 2022

Problem Description

Creating a batch of reports prints all details in console.

Expected behavior

A silent option when creating the report would be appreciated.

Additional context

I have a huge set of experiments, with lots of synthetic samples. I compute the quality and diagnostic reports for every sample, and every experiment, so the console is continuosly printing all reports summaries, which is not useful. I store these metrics as CSV to make further comparisons between experiments.

@alejandrofdez-us alejandrofdez-us added feature request Request for a new feature new Label applied to new issues labels Nov 19, 2022
@npatki
Copy link
Contributor

npatki commented Nov 22, 2022

Hi @alejandrofdez-us, thanks for filing this feature request. We'll keep it open and provide updates as we solve it.

Workarounds

If you'd like to run your reports in the meantime, there seem to be methods for silencing the statements on your own outside of the SDMetrics library. The relevant portions are the tqdm library and stdout. For example, I see the following Stackoverflow conversations for silencing tqdm and stdout.

Trying these suggestions seemed to correctly silence the output for me (but your mileage may vary).

from tqdm import tqdm
from functools import partialmethod
from sdmetrics import load_demo 
from sdmetrics.reports.single_table import QualityReport
import sys, os

# silence the tqdm and printing functions
tqdm.__init__ = partialmethod(tqdm.__init__, disable=True)
sys.stdout = open(os.devnull, 'w')

# generate the report
real_data, synthetic_data, metadata = load_demo(modality='single_table')
report = QualityReport()
report.generate(real_data, synthetic_data, metadata)

@npatki npatki added under discussion Issue is currently being discussed feature:reports Related to any of the generated reports and removed new Label applied to new issues labels Nov 22, 2022
@alejandrofdez-us
Copy link
Author

Dear npatki,
thanks for your response. I've already tried this workaround, but it still prints the summary in console. For instance, in your example it prints the following:

Overall Quality Score: 82.84%

Properties:
Column Shapes: 82.78%
Column Pair Trends: 82.9%

Fortunately, at least tqdm is disabled with your proposal, but sdv manages to get the real stdout somehow.

@alejandrofdez-us
Copy link
Author

Apart from reporting, I would add that the sampling generation should have a silence mode as well.

@npatki
Copy link
Contributor

npatki commented Nov 28, 2022

Hi @alejandrofdez-us,

thanks for your response. I've already tried this workaround, but it still prints the summary in console.

You're welcome! Based on how exactly you are running the Python script, there may be other solutions to this. For example, here is another option.

Apart from reporting, I would add that the sampling generation should have a silence mode as well.

You are welcome to file a new issue for this in the SDV library. We can use it to separately track and provide updates for it.

@npatki npatki removed the under discussion Issue is currently being discussed label Dec 9, 2022
@npatki npatki added this to the 0.9.0 milestone Jan 17, 2023
@npatki
Copy link
Contributor

npatki commented Jan 17, 2023

Update! This is on the roadmap for the next SDMetrics release.

Both quality and diagnostic reports will include a verbose parameter that will be True by default but can be toggled.

report = QualityReport()
report.generate(real_data, synthetic_data, metadata, verbose=False)

report = DiagnosticReport()
report.generate(real_data, synthetic_data, metadata, verbose=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:reports Related to any of the generated reports feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants