8000 DOC: use notebook-style for plot_ward_structured_vs_unstructured.py by krishnakoumar27 · Pull Request #23228 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DOC: use notebook-style for plot_ward_structured_vs_unstructured.py #23228

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

Conversation

krishnakoumar27
Copy link
Contributor
@krishnakoumar27 krishnakoumar27 commented Apr 27, 2022

Reference Issues/PRs

Part of #22406

What does this implement/fix? Explain your changes.

Updated the example plot_ward_structured_vs_unstructured.py and added some comments for readability.

Any other comments?

Pleas let me know if there are any room for improvement.

# -----------
#
# Plotting the structured hierarchical clusters.

fig = plt.figure()
ax = fig.add_subplot(111, projection="3d", elev=7, azim=-80)
ax.set_position([0, 0, 0.95, 1])
Copy link
Member

Choose a reason for hiding this comment

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

The title is not shown on the graph. Can you edit l.132 with

ax.set_title(f"With connectivity constraints (time {elapsed_time:.2f}s)")

@@ -72,14 +87,20 @@
)
plt.title("Without connectivity constraints (time %.2fs)" % elapsed_time)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
plt.title("Without connectivity constraints (time %.2fs)" % elapsed_time)
ax.set_title(f"Without connectivity constraints (time {elapsed_time:.2f}s)")

Comment on lines 111 to 112
print("Elapsed time: %.2fs" % elapsed_time)
print("Number of points: %i" % label.size)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
print("Elapsed time: %.2fs" % elapsed_time)
print("Number of points: %i" % label.size)
print(f"Elapsed time: {elapsed_time:.2f}s")
print(f"Number of points: {label.size}")

Comment on lines 66 to 67
print("Elapsed time: %.2fs" % elapsed_time)
print("Number of points: %i" % label.size)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
print("Elapsed time: %.2fs" % elapsed_time)
print("Number of points: %i" % label.size)
print(f"Elapsed time: {elapsed_time:.2f}s")
print(f"Number of points: {label.size}")

@lesteve lesteve added the Quick Review For PRs that are quick to review label Apr 29, 2022
@lesteve lesteve mentioned this pull request Apr 29, 2022
47 tasks
@krishnakoumar27
Copy link
Contributor Author

Hi @glemaitre, thanks for the follow up. I have made the changes that you have suggested.

@glemaitre glemaitre merged commit 920ab25 into scikit-learn:main May 1, 2022
@glemaitre
Copy link
Member

Thanks @krishnakoumar27

glemaitre added a commit to glemaitre/scikit-learn that referenced this pull request May 19, 2022
glemaitre added a commit that referenced this pull request May 19, 2022
…23228)

Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Quick Review For PRs that are quick to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0