[ENH] Fix typos, improve exception handling, and update warning stacklevel in BaseModel and encoders#2210
Open
Kayd-06 wants to merge 1 commit intosktime:mainfrom
Open
[ENH] Fix typos, improve exception handling, and update warning stacklevel in BaseModel and encoders#2210Kayd-06 wants to merge 1 commit intosktime:mainfrom
Kayd-06 wants to merge 1 commit intosktime:mainfrom
Conversation
…in BaseModel and encoders
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2210 +/- ##
=======================================
Coverage ? 86.62%
=======================================
Files ? 165
Lines ? 9736
Branches ? 0
=======================================
Hits ? 8434
Misses ? 1302
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description:
This Pull Request addresses several small but important code quality issues in the
pytorch_forecastinglibrary. These changes improve code maintainability, ensure robust error handling during model initialization, and significantly enhance the usability of library warnings by providing better traceability for end-users.Key Changes:
monotinicity_losstomonotonicity_lossthroughout _base_model.py and its comments to align with standard naming conventions.# add additionl loss-># add additional loss.except:clause inBaseModel.__init__toexcept Exception:. This change prevents catching system-level exceptions while still defensively skipping individual non-serializable hyperparameters to prevent training crashes.stacklevel=3towarnings.warncalls in _base_model.py and encoders.py.encoder.transform()is called) rather than pointing to the internal library file. This follows standard Python library best practices (similar topandasornumpy).Did you add any tests for the change?
UserWarningin NaNLabelEncoder. Confirmed the warning traceback correctly identifies the caller's line number after the fix.TemporalFusionTransformer(tests/test_models/test_temporal_fusion_transformer.py). All 38 tests passed (excluding one pre-existing numerical precision assertion) confirming no functional regressions in BaseModel logic.PR checklist: