Repository navigation
DOC: Consolidated density-based clustering examples - #32228
j-hendricks wants to merge 7 commits into
Conversation
| # Remove black and use for noise instead. | ||
| unique_labels = set(labels) | ||
|
|
||
| colors = [plt.cm.Spectral(each) for each in np.linspace(0, 1, len(set(labels)))] |
There was a problem hiding this comment.
[Minor] Reuse a predefined variable.
| colors = [plt.cm.Spectral(each) for each in np.linspace(0, 1, len(set(labels)))] | |
| colors = [plt.cm.Spectral(each) for each in np.linspace(0, 1, len(unique_labels))] |
| markeredgecolor="black", | ||
| alpha=0.5 if k == -1 else 0.1 + 0.9 * proba_map[ci], | ||
| ) | ||
| n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0) |
There was a problem hiding this comment.
[Minor] Resue a predefined variable.
| n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0) | |
| n_clusters_ = len(unique_labels) - (1 if -1 in labels else 0) |
| "x" if k == -1 else "o", | ||
| markerfacecolor=tuple(col), | ||
| markeredgecolor="black", | ||
| alpha=0.5 if k == -1 else 0.1 + 0.9 * proba_map[ci], |
There was a problem hiding this comment.
[Suggestion] Remove proba_map entirely, since as far as I can see it only adds extra overhead (?). The mapping in the dictionary still relies on the original indexes of the array anyhow.
| alpha=0.5 if k == -1 else 0.1 + 0.9 * proba_map[ci], | |
| alpha=0.5 if k == -1 else 0.1 + 0.9 * probabilities[ci], |
|
Hello @j-hendricks, this review was a contribution of a participant in the EuroPython/EuroScipy scikit-learn sprint. Happy to help in the process of consolidating this PR as well. :) |
Co-authored-by: John Hendricks <[email protected]> Co-authored-by: Dominic Austria <daustria>
…tually being scaled
…ance are different metrics
6980a99 to
1b3e5b0
Compare
|
@mcvincekova thank you for the feedback. I agree with the suggestions you made and have incorporated them into the PR. I have fixed some formatting issues as well. @StefanieSenger if you wouldn't mind taking a look at the rendered doc, that would also be greatly appreciated :) Only remaining issue I see: at the end of the page it says "Total running time of the script:" followed by a time measurement. I have no idea what code is causing that to render and would like to remove it before merging |
mcvincekova
left a comment
There was a problem hiding this comment.
@j-hendricks imho looks good. Thanks for addressing the comments.
Reference Issues/PRs
Fixes #29962. Completes closed PR #31102.
What does this implement/fix? Explain your changes.
Consolidates 3 related example docs (DBSCAN, HDBSCAN, and OPTICS) into one concise example.
Follows advice from ArturoAmorQ, namely using only one dataset for conciseness.
Removes detailed explanations of algorithm design as these are already explained in the user guide.
Any other comments?
Builds upon original PR #31102 and uses much of the original explanation and code authored by daustria. Therefore, I have added them as a co-author.