-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
MAINT, API Change trunk-classification into three separate functions for generating trunk, trunk-mix, trunk-overlap and marron-wand #227
Conversation
Signed-off-by: Adam Li <[email protected]>
sktree/datasets/hyppo.py
Outdated
@@ -205,7 +213,7 @@ def make_trunk_classification( | |||
) | |||
) | |||
elif simulation == "trunk_mix": | |||
mixture_idx = rng.choice(2, n_samples // 2, replace=True, shuffle=True, p=[mix, 1 - mix]) | |||
mixture_idx = rng.choice(2, n_samples // 2, replace=True, shuffle=True, p=[mix, 1 - mix]) # type: ignore | |||
norm_params = [[mu_0, cov * (2 / 3) ** 2], [mu_1, cov * (2 / 3) ** 2]] |
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.
@sampan501 can you explain why we have a (2/3)**2 here and only in trunk-mix?
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.
When variance is 1, trunk-mix does not look bimodal at low dimensions. I set it to (2/3)**2 since that is consistent with Marron and Wand bimodal
sktree/datasets/hyppo.py
Outdated
@@ -205,7 +213,7 @@ def make_trunk_classification( | |||
) | |||
) | |||
elif simulation == "trunk_mix": | |||
mixture_idx = rng.choice(2, n_samples // 2, replace=True, shuffle=True, p=[mix, 1 - mix]) | |||
mixture_idx = rng.choice(2, n_samples // 2, replace=True, shuffle=True, p=[mix, 1 - mix]) # type: ignore | |||
norm_params = [[mu_0, cov * (2 / 3) ** 2], [mu_1, cov * (2 / 3) ** 2]] |
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.
When variance is 1, trunk-mix does not look bimodal at low dimensions. I set it to (2/3)**2 since that is consistent with Marron and Wand bimodal
Signed-off-by: Adam Li <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #227 +/- ##
==========================================
- Coverage 89.68% 89.67% -0.01%
==========================================
Files 54 54
Lines 4963 4978 +15
==========================================
+ Hits 4451 4464 +13
- Misses 512 514 +2 ☔ View full report in Codecov by Sentry. |
@adam2392 Good to merge after changelog update |
Signed-off-by: Adam Li <[email protected]>
Signed-off-by: Adam Li <[email protected]>
Signed-off-by: Adam Li <[email protected]>
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.
Looks good! For simplicity, there is a lot of error checks that are common for all 3 functions. Maybe we can wrap those up into a private method?
Other than that, pending CI, lgtm |
Signed-off-by: Adam Li <[email protected]>
Good idea. Rn tho there's only a few. We could migrate the covariance matrix stuff to a |
Fair, I'll make an issue for it |
Signed-off-by: Adam Li <[email protected]>
Changes proposed in this pull request:
make_trunk_classification
into three functions:make_trunk_class*
,make_trunk_mixture_class*
, andmake_marron_wand_class*
so that we can separate logic for simulating trunk, trunk-overlap, trunk-mix and marron-wand simulationsBefore submitting
section of the
CONTRIBUTING
docs.Writing docstrings section of the
CONTRIBUTING
docs.After submitting