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

Fixes #812 #813

Merged
merged 6 commits into from
Apr 24, 2024
Merged

Fixes #812 #813

merged 6 commits into from
Apr 24, 2024

Conversation

ocraft
Copy link
Contributor

@ocraft ocraft commented Apr 18, 2024

Fix for #812

@@ -664,7 +664,7 @@ def log_sklearn_plot(
raise InvalidPlotTypeError(name)

sklearn_kwargs = {
k: v for k, v in kwargs.items() if k not in plot_config or k != "normalized"
k: v for k, v in kwargs.items() if k not in plot_config or k == "normalized"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
k: v for k, v in kwargs.items() if k not in plot_config or k == "normalized"
k: v for k, v in kwargs.items() if k not in plot_config

We don't need any check for normalized here. It's already part of plot_config, which is all that's needed. We don't want to include it in sklearn_kwargs since it's purely to set the dvc plots template to confusion_normalized.

@dberenbaum
Copy link
Contributor

Thanks @ocraft! Ideally, I would like to make title, x_label, y_label, and normalized all named arguments to log_sklearn_plot() for a couple reasons:

  1. It looks like all of these are undocumented and hidden now (I'm curious how you found out how to use them)
  2. The docs state that kwargs are passed to the underlying sklearn methods, which is inaccurate since it is really a mix of these dvc plot parameters and sklearn args. It would be better to keep these separate rather than rely on this implicit parsing of the kwargs.

If you are interested, feel free to try this, but I'm fine to merge without that if it's beyond what you want to take on.

@ocraft
Copy link
Contributor Author

ocraft commented Apr 18, 2024

I think that I can do that. Personally, I just expected that log_plot and log_sklearn_plot would have the same arguments; it seemed logical to me.

@codecov-commenter
Copy link

codecov-commenter commented Apr 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.52%. Comparing base (602c053) to head (c7b66ef).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #813      +/-   ##
==========================================
+ Coverage   95.47%   95.52%   +0.04%     
==========================================
  Files          57       57              
  Lines        3889     3951      +62     
  Branches      353      353              
==========================================
+ Hits         3713     3774      +61     
- Misses        124      125       +1     
  Partials       52       52              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 679 to 681
sklearn_kwargs = {k: v for k, v in kwargs.items() if k not in plot_config}
plot.step = self.step
plot.dump(val, **sklearn_kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
sklearn_kwargs = {k: v for k, v in kwargs.items() if k not in plot_config}
plot.step = self.step
plot.dump(val, **sklearn_kwargs)
plot.step = self.step
plot.dump(val, **kwargs)

Since the plot config options are now named args, I don't think it should be necessary to do anything here but pass kwargs directly.

Copy link
Contributor

@dberenbaum dberenbaum left a comment

Choose a reason for hiding this comment

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

@ocraft Please see the one comment. If you can ping me once it's ready, it should be good to approve after that. Thanks again!

@ocraft
Copy link
Contributor Author

ocraft commented Apr 24, 2024

@dberenbaum Done :)

@dberenbaum dberenbaum merged commit 3414163 into iterative:main Apr 24, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants