Added DBScan clustering to ColorPaletteSampler#753
Merged
Arlodotexe merged 3 commits intoCommunityToolkit:mainfrom Dec 12, 2025
Merged
Added DBScan clustering to ColorPaletteSampler#753Arlodotexe merged 3 commits intoCommunityToolkit:mainfrom
Arlodotexe merged 3 commits intoCommunityToolkit:mainfrom
Conversation
… are too similar after KMeans
Contributor
There was a problem hiding this comment.
Pull Request Overview
Enhances the ColorPaletteSampler by integrating DBScan clustering to merge similar KMeans results, addressing the limitation where KMeans clusters to K points regardless of color similarity.
- Added DBScan clustering post-processing to merge KMeans clusters that are too similar
- Introduced a configurable merge distance parameter for similarity threshold
- Modified weight calculation to properly handle cluster merging
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| ColorPaletteSampler.cs | Added DBScan post-processing step with merge distance parameter and updated weight handling |
| ColorPaletteSampler.KMeans.cs | Changed method visibility from private to internal to support DBScan integration |
| ColorPaletteSampler.DBScan.cs | Implemented complete DBScan clustering algorithm as a ref struct with weighted centroid calculation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
components/ColorAnalyzer/src/ColorPaletteSampler/ColorPaletteSampler.DBScan.cs
Outdated
Show resolved
Hide resolved
components/ColorAnalyzer/src/ColorPaletteSampler/ColorPaletteSampler.DBScan.cs
Outdated
Show resolved
Hide resolved
components/ColorAnalyzer/src/ColorPaletteSampler/ColorPaletteSampler.DBScan.cs
Outdated
Show resolved
Hide resolved
components/ColorAnalyzer/src/ColorPaletteSampler/ColorPaletteSampler.DBScan.cs
Show resolved
Hide resolved
borzellinorenato35-cmyk
approved these changes
Nov 8, 2025
Arlodotexe
approved these changes
Dec 12, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The DBScan step runs after KMeans to merge clusters that are too similar.
KMeans cannot be refined on its own to not have this issue, since it simply clusters to K points. Determining the right number for K is no better than just merging the results with another clustering method.