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

K-means++ #23

Merged
merged 12 commits into from
Oct 14, 2022
Merged

K-means++ #23

merged 12 commits into from
Oct 14, 2022

Conversation

martinkim0
Copy link
Member

Closes #21.

@codecov
Copy link

codecov bot commented Oct 5, 2022

Codecov Report

Merging #23 (ab82c31) into main (cf2fea2) will decrease coverage by 1.29%.
The diff coverage is 90.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
- Coverage   94.44%   93.15%   -1.30%     
==========================================
  Files          12       14       +2     
  Lines         432      482      +50     
==========================================
+ Hits          408      449      +41     
- Misses         24       33       +9     
Flag Coverage Δ
unittests 93.15% <90.90%> (-1.30%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/scib_metrics/utils/_utils.py 78.57% <78.57%> (ø)
src/scib_metrics/utils/_kmeans.py 93.40% <94.28%> (-6.60%) ⬇️
src/scib_metrics/_types.py 100.00% <100.00%> (ø)

@martinkim0 martinkim0 self-assigned this Oct 13, 2022
@martinkim0 martinkim0 marked this pull request as ready for review October 13, 2022 18:38
Copy link
Member

@adamgayoso adamgayoso left a comment

Choose a reason for hiding this comment

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

LGTM

@adamgayoso adamgayoso merged commit af58643 into main Oct 14, 2022
@adamgayoso adamgayoso deleted the martin/kmeans-21 branch October 14, 2022 16:19
_, mask, _ = state
return jnp.sum(mask) < n_clusters

dists = cdist(X, X)
Copy link
Contributor

Choose a reason for hiding this comment

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

why doesnt this get passed in? Kind of confusing and can lead to bugs potentially

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, don't the inner functions have access to outer variables? I was thinking it would be fine since dists is not being written to.

Copy link
Contributor

Choose a reason for hiding this comment

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

yea it all technically works, its just a matter of code style to prevent bugs. I would recommend avoiding using variables that are instantiated later in the file, and also giving code the opportunity to mutate a shared variable. this is a just a nit, dw about changing it now.

Copy link
Member Author

Choose a reason for hiding this comment

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

makes sense! thx for the feedback, I'll change it when I can

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

Successfully merging this pull request may close these issues.

Implement K-means++ initialization
3 participants