-
Notifications
You must be signed in to change notification settings - Fork 81
Make DifferencingTransform
to fail on new segments with understandable error
#1141
Merged
Merged
Changes from 15 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3894fa0
Fix DifferencingTransform to fail on new segments during inverse_tran…
5fee970
Update changelog
9d91c3a
Try to add ignoring of Deprecated call to
0dd253a
Try to add ignoring of Deprecated call to
dfc862b
Try to add ignoring of Deprecated call to
bc76fee
Fix DeprecationWarning
48b0caf
Start ignoring warnings
1279dbe
Start ignoring warnings
4eb3891
Make transform to fail on new segments
c20d6ea
Merge branch 'inference-v2.1' into issue-1137
55ee14e
Fix merge with inference-2.1
ddf2751
Extract check_new_segments
a7e65d5
Small fixes from PR comments
9ce2eb6
Fix tests
2448dea
Fix changelog
1d2af62
Remove unnecessary attribute, move assignment in fit at the end
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 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 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 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 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 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 |
---|---|---|
@@ -1,8 +1,23 @@ | ||
import re | ||
import reprlib | ||
from typing import List | ||
from typing import Optional | ||
from typing import Set | ||
|
||
|
||
def match_target_quantiles(features: Set[str]) -> Set[str]: | ||
"""Find quantiles in dataframe columns.""" | ||
pattern = re.compile("target_\d+\.\d+$") | ||
return {i for i in list(features) if pattern.match(i) is not None} | ||
|
||
|
||
def check_new_segments(transform_segments: List[str], fit_segments: Optional[List[str]]): | ||
"""Check if there are any new segments that weren't present during training.""" | ||
if fit_segments is None: | ||
raise ValueError("Transform is not fitted!") | ||
|
||
new_segments = set(transform_segments) - set(fit_segments) | ||
if len(new_segments) > 0: | ||
raise NotImplementedError( | ||
f"This transform can't process segments that weren't present on train data: {reprlib.repr(new_segments)}" | ||
) |
This file contains 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 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 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.
Do we need this attribute? You use it only in fit