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

ENH Support for sparse matrices added to sklearn.metrics.silhouette_samples #24677

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

awinml
Copy link
Contributor

@awinml awinml commented Oct 16, 2022

Reference Issues/PRs

Fixes #18524
Fixes #18723

What does this implement/fix? Explain your changes.

Support for sparse matrices added to sklearn.metrics.silhouette_samples
Suggestions from the original stalled PR were implemented.

The changes update the reduce function used for computing the intra-cluster and inter-cluster distances. The current version is failing at, a) the pre-computed check for sparse matrices while getting the diagonal elements b) when trying to index a sparse matrix to pass weights to np.bincount function

  • Multiple merge conflicts with main were resolved.
  • New test test_silhouette_sparse_implementation was added to check implementation of silhouette_samples with sparse matrices.
  • Check for non-zero diagonal entries in silhouette_samples was updated to work with sparse matrices.

@awinml awinml changed the title [MRG] Support for sparse matrices added to sklearn.metrics.silhouette_samples ENH Support for sparse matrices added to sklearn.metrics.silhouette_samples Oct 19, 2022
@awinml
Copy link
Contributor Author

awinml commented Oct 19, 2022

@thomasjpfan Would you kindly review this? I have made the suggested changes. I have also added a test to check implementation of silhouette_samples with sparse matrices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sklearn.metrics.silhouette_samples does not work with sparse matrices
1 participant