-
Notifications
You must be signed in to change notification settings - Fork 1
Addressing Normalization TODO in clustering.py #81
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
Conversation
…ly sizeable refactor of the various transformations in the dataset file and adding a number of tests.
|
|
||
| normalized_data = np.empty((matrix.shape[0], 0)) | ||
|
|
||
| # Apply QuantileTransformer to each column and concatenate the results |
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.
Literally no idea why this was being done per column...
|
|
||
| normalized_data = np.empty((matrix.shape[0], 0)) | ||
|
|
||
| # Apply MinMaxScaler to each column and concatenate the results |
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.
Literally no idea why this was being done per column...
lotif
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.
Awesome refactor! LGTM!
📝 WalkthroughWalkthroughThis pull request refactors the clustering normalization system to consolidate normalization logic using a newly renamed DataAndKeyNormalizationType enum (formerly KeyScalingType). The changes unify the dual-path numerical normalization (MINMAX vs QUANTILE) into a single normalized array approach, update function signatures in clustering.py to accept and propagate the normalization type parameter, and rename/repurpose the get_normalized_numerical_columns utility function. Additionally, unit tests are added for normalization utilities, and a minor typo in an enum docstring is corrected. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🧰 Additional context used🧬 Code graph analysis (2)tests/unit/models/clavaddpm/test_clustering.py (3)
src/midst_toolkit/models/clavaddpm/clustering.py (1)
🪛 Ruff (0.14.3)src/midst_toolkit/models/clavaddpm/clustering.py369-369: Avoid specifying long messages outside the exception class (TRY003) 502-502: Avoid specifying long messages outside the exception class (TRY003) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (13)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Type
Refactor
Short Description
Clickup Ticket(s): https://app.clickup.com/t/868g7a81q
This PR addresses a TODO in the clustering code that aimed at re-considering how the normalization functions are structured.
Tests Added
Tests were added for the functions that I materially touch in this refactor.