-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Modified save argument of plot_model() #1537
Conversation
Hey @bhanuteja2001 thank you for doing this. Could we do something like this instead for all plots? if save:
if not isinstance(save, bool):
plot_filename = os.path.join(save, plot_filename)
logger.info(f"Saving '{plot_filename}'")
fig.write_html(plot_filename) This will be much easier to maintain. Thanks! Let me know if you have any questions. |
@Yard1 sure let's do it this way |
@Yard1 I have made the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just a few more comments. Happy to merge once those are addressed and CI passes 🚀
pycaret/internal/tabular.py
Outdated
@@ -6918,8 +6934,10 @@ def tree(): | |||
display.move_progress() | |||
display.clear_output() | |||
if save: | |||
logger.info(f"Saving '{plot_name}.png' in current active directory") | |||
plt.savefig(f"{plot_name}.png", bbox_inches="tight") | |||
if not isinstance(save, bool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation
pycaret/internal/tabular.py
Outdated
@@ -6963,8 +6981,10 @@ def calibration(): | |||
display.move_progress() | |||
display.clear_output() | |||
if save: | |||
logger.info(f"Saving '{plot_name}.png' in current active directory") | |||
plt.savefig(f"{plot_name}.png", bbox_inches="tight") | |||
if not isinstance(save, bool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation
pycaret/internal/tabular.py
Outdated
@@ -7607,7 +7631,10 @@ def summary(show: bool = True): | |||
shap_plot = shap.summary_plot(shap_values, test_X, show=show, **kwargs) | |||
|
|||
if save: | |||
plt.savefig(f"SHAP {plot}.png", bbox_inches="tight") | |||
if save == True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed here
pycaret/internal/tabular.py
Outdated
@@ -7640,7 +7667,10 @@ def correlation(show: bool = True): | |||
logger.info("model type detected: type 2") | |||
shap.dependence_plot(dependence, shap_values, test_X, show=show, **kwargs) | |||
if save: | |||
plt.savefig(f"SHAP {plot}.png", bbox_inches="tight") | |||
if save == True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed here
@Yard1 please check now. |
Enchancement #1288
Describe the changes you've made
Modified the save argument of plot_model to save the figure at the destination mentioned by the user. Instead of just saving the figure in the current directory.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Tested with the confusion matrix plot.
Describe if there is any unusual behaviour of your code(Write
NA
if there isn't)NA
Checklist:
Screenshots