-
Notifications
You must be signed in to change notification settings - Fork 32
DSB fixes #165
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
DSB fixes #165
Conversation
ilia-kats
commented
Aug 14, 2025
- make it match the R reference implementation
- implement some options that are present in the R reference implementations but were missing here
ilan-gold
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small things, but nice1
|
|
||
| if denoise_counts: | ||
| bgmeans = np.empty(cells_scaled.shape[0], np.float32) | ||
| bgmeans = np.empty(cells_scaled.shape[0], cells_scaled.dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we making the bgmeans the same dtype as the input? It looks like bgmeans is filled in with mean values - why not just set it to float64? It seems like you'd have the same type-loss problem as with ints then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At that point, cells_scaled will always be a float. If it's float32, then the GaussianMixture results will also be float32, so no need to waste memory by using a dtype that is too large.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, I can move the castback to the very bottom of the function, so we do all our calculations in float64 and only cast back the result if the input was float32.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, ok you're right!
|
|
||
| if denoise_counts: | ||
| bgmeans = np.empty(cells_scaled.shape[0], np.float32) | ||
| bgmeans = np.empty(cells_scaled.shape[0], cells_scaled.dtype) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, ok you're right!