Skip Plotting in Table Report Based on Max Columns Given - #1255
Conversation
…eneration behavior
jeromedockes
left a comment
There was a problem hiding this comment.
this is great, thank you very much @priscilla-b ! especially when we are inspecting intermediate steps in a pipeline, we often end up with dataframes that have a lot of columns and this will allow checking them without waiting a long time to generate lots of plots we won't look at 🚀
In fact it is so useful that I think the default should not be None but maybe 30 or something like that. but that would require adding clear messages in the report itself telling users what to do if they really want the plots, so it could be left for another pull request.
| if "_summary_with_plots" in self.__dict__: | ||
| return self._summary_with_plots | ||
| return self._summary_without_plots | ||
| if self.max_plot_columns is None: |
There was a problem hiding this comment.
this is a great way of handling it! I think we should rename _any_summary and make it a regular method rather than a property. maybe self._any_summary -> self._get_summary()?
There was a problem hiding this comment.
I thought of this but wasn't sure the benefits of having it as a method than a property, so decided to maintain the existing implementation
There was a problem hiding this comment.
sorry for the nitpick: could we rename get_summary to _get_summary? this is not something for users and we want the freedom to change the contents of the summary whenever we want so the leading underscore indicates it's not part of the public API
|
In fact it is so useful that I think the default should not be None but maybe 30 or something like that.
+1
but that would require adding clear messages in the report itself telling users what to do if they really want the plots, so it could be left for another pull request.
Indeed a message visible somewhere (like the tab being greyed out and when the mouse goes over it a box appears giving the message). But probably for another PR because it requires markedly more work.
|
Co-authored-by: Jérôme Dockès <jerome@dockes.org>
|
Will look into the issue of changing the default param to some arbitrary number |
|
very nice @priscilla-b ! thanks for adding the message and doing the extra work to make it dismissable! |
jeromedockes
left a comment
There was a problem hiding this comment.
thanks! I know it's still in draft mode but took a quick look anyway :)
this really speeds up the report, now when there are many columns the bottleneck is definitely the computation of column associations
| this.elem.querySelector("[data-role='dismiss-button']") | ||
| .addEventListener("click", (e) => this.hide(e)); | ||
| } | ||
|
|
||
| hide(event) { | ||
| this.elem.style.display = "none"; | ||
| } |
There was a problem hiding this comment.
| this.elem.querySelector("[data-role='dismiss-button']") | |
| .addEventListener("click", (e) => this.hide(e)); | |
| } | |
| hide(event) { | |
| this.elem.style.display = "none"; | |
| } | |
| this.elem.querySelector("[data-role='dismiss-button']") | |
| .addEventListener("click", (e) => this.hide()); | |
| } |
There was a problem hiding this comment.
I think here we can rely on the parent classe's hide() to hide the whole element and it simplifies things slightly?
|
|
||
|
|
||
| def patch_display(pandas=True, polars=True, verbose=1): | ||
| def patch_display(pandas=True, polars=True, verbose=1, max_plot_columns=None): |
There was a problem hiding this comment.
here also we could put 30 instead of None as the default
| summary["n_constant_columns"] = sum( | ||
| c["value_is_constant"] for c in summary["columns"] | ||
| ) | ||
| summary["plots_skipped"] = all(not c["plot_names"] for c in summary["columns"]) |
There was a problem hiding this comment.
I think we can define this based on the argument rather than inspecting the results, something like summary["plots_skipped"] = not with_plots. I think it is a bit simpler and slightly more robust (for example in the weird edge case where all columns are constant there will be no plots but not because they are skipped just because there is nothing to plot). WDYT?
There was a problem hiding this comment.
Yes I think I did this at first, but I thought we were just reverting the argument and not really checking the presence of the actual plots. But yeah, what I did makes it more complicated, and should just keep it simple.
| if "_summary_with_plots" in self.__dict__: | ||
| return self._summary_with_plots | ||
| return self._summary_without_plots | ||
| if self.max_plot_columns is None: |
There was a problem hiding this comment.
sorry for the nitpick: could we rename get_summary to _get_summary? this is not something for users and we want the freedom to change the contents of the summary whenever we want so the leading underscore indicates it's not part of the public API
| # there are too many columns | ||
| # Will be accessed in the HTML template to display a message to the user | ||
| summary["plots_auto_skipped"] = ( | ||
| summary["plots_skipped"] and self.max_plot_columns == 30 |
There was a problem hiding this comment.
I'm not sure why we compare max_plot_columns to 30 here? for example if the user sets it to 20 it would still be skipped?
maybe the template can look directly at plots_skipped which you add in summarize, or we could create a flag in the conditional blocks above that we then use eg
...
summary = self._summary_with_plots
plots_skipped = False
else:
summary = self._summary_without_plots
plots_skipped = True
summary['plots_auto_skipped'] = plots_skippedThere was a problem hiding this comment.
I was thinking that if the user set the param to skip the plots directly, they wouldn't need to be shown a message explaining why the plots were skipped.
I wanted to show the message only when the plots were automatically skipped, but couldn't really figure out a simple implementation for checking if the default value is being used or not
There was a problem hiding this comment.
aah ok I understand now, thanks. I didn't realize the goal was to avoid showing the message when the user intentionally skipped plotting by setting max_plot_columns.
I think it might be good to show the message whenever plotting was skipped, even if it is intentional, especially since you made it easy to dismiss the message but both options make sense
|
Hey @priscilla-b, thanks for working on this! It seems like the tiles without distributions are somewhat redundant with the 'stats' panel (the only difference being the IQR). Would it make sense to remove them entirely and display only your message in the distribution panel? |
that's a good point. Still I would like to have this PR for the next release so maybe we should finish the few remaining details for the current version and open a separate issue for follow-ups? |
|
Hi Jerome,
Yes I will complete this and reopen by close of day.
…On Mon, 31 Mar 2025 at 3:42 PM, Jérôme Dockès ***@***.***> wrote:
It seems like the tiles without distributions are somewhat redundant with
the 'stats' panel
that's a good point. Still I would like to have this PR for the next
release so maybe we should finish the few remaining details for the current
version and open a separate issue for follow-ups?
—
Reply to this email directly, view it on GitHub
<#1255 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APZQ2LXYUTN7UYCZTTGA7U32XFO47AVCNFSM6AAAAABZIFLBSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRWGYZTGNBTGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: jeromedockes]*jeromedockes* left a comment (skrub-data/skrub#1255)
<#1255 (comment)>
It seems like the tiles without distributions are somewhat redundant with
the 'stats' panel
that's a good point. Still I would like to have this PR for the next
release so maybe we should finish the few remaining details for the current
version and open a separate issue for follow-ups?
—
Reply to this email directly, view it on GitHub
<#1255 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APZQ2LXYUTN7UYCZTTGA7U32XFO47AVCNFSM6AAAAABZIFLBSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRWGYZTGNBTGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Right, let's do this in two steps then 👍 |
Vincent-Maladiere
left a comment
There was a problem hiding this comment.
Looks good on VSCode!
jeromedockes
left a comment
There was a problem hiding this comment.
LGTM! Thanks again @priscilla-b 🎉
…1255) Co-authored-by: Jérôme Dockès <jerome@dockes.org>
…1255) Co-authored-by: Jérôme Dockès <jerome@dockes.org>
Co-authored-by: Jérôme Dockès <jerome@dockes.org>


fixes #1245