-
Notifications
You must be signed in to change notification settings - Fork 36
[TO_REVIEW] Add automatic target label masking to prevent data leakage #330
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
Merged
tgnassou
merged 14 commits into
scikit-adaptation:main
from
YanisLalou:auto_mask_target_labels
Sep 22, 2025
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7e4de8f
Add _auto_mask_target_labels to prevent data leakage
YanisLalou a1adf4e
Merge branch 'main' into auto_mask_target_labels
YanisLalou 9b5c4f0
remove mask_target_labels attribute to SelectSourceTarget, seems irre…
YanisLalou b126315
Disable automatic target label masking for supervised selectors
YanisLalou 9fdae8b
Merge branch 'main' into auto_mask_target_labels
YanisLalou d202b2a
Disable masking for SelectSourceTarget
YanisLalou 2a8302f
Fix doc with the new mask_target_labels attribute when instantiating …
YanisLalou a5f3f6a
Merge branch 'main' into auto_mask_target_labels
YanisLalou 7317915
Merge branch 'main' into auto_mask_target_labels
rflamary 35f0057
Merge branch 'main' into auto_mask_target_labels
antoinecollas 38716df
Merge branch 'main' into auto_mask_target_labels
tgnassou 798873e
rm useless line
tgnassou 91a8925
Merge branch 'main' into auto_mask_target_labels
rflamary d20c7bb
Merge branch 'main' into auto_mask_target_labels
tgnassou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,11 +161,15 @@ | |
| params : dict | ||
| Additional parameters declared in the routing | ||
| """ | ||
| y_type = _find_y_type(y) | ||
| if y_type == Y_Type.DISCRETE: | ||
| unmasked_idx = y != _DEFAULT_MASKED_TARGET_CLASSIFICATION_LABEL | ||
| elif y_type == Y_Type.CONTINUOUS: | ||
| unmasked_idx = np.isfinite(y) | ||
| if "sample_domain" in params: | ||
|
||
| unmasked_idx = params["sample_domain"] >= 0 | ||
| else: | ||
| y_type = _find_y_type(y) | ||
| if y_type == Y_Type.DISCRETE: | ||
| unmasked_idx = y != _DEFAULT_MASKED_TARGET_CLASSIFICATION_LABEL | ||
| elif y_type == Y_Type.CONTINUOUS: | ||
| unmasked_idx = np.isfinite(y) | ||
|
|
||
| X, y, params = _apply_domain_masks(X, y, params, masks=unmasked_idx) | ||
| return X, y, params | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 is it false here?
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.
I don't get why the use of SelectSourceTarget?
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 you do that you have one PCA for source anc one for target but SVC is traine donly on source
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.
So we should be able to mask target label with SelectSourceTarget no ? We don't want data leakage even if we have one PCA for source and one for target ?