[BUG] Fix DummyProbaRegressor._predict_var returning std dev instead of variance#976
Open
maniktyagi04 wants to merge 1 commit intosktime:mainfrom
Open
Conversation
…of variance - In , added alongside the existing - In , replaced with so the method correctly returns variance (σ²) instead of standard deviation (σ) - Added with 5 new tests covering: - predict_var matches np.var(y_train) for both 'empirical' and 'normal' strategies - predict_var does NOT equal std dev (regression test) - predict_var is non-negative - predict_var has correct index/columns Fixes #ISSUE_NUMBER
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.
Fixes #975
Summary
DummyProbaRegressor._predict_varwas incorrectly returning the standard deviation (σ) of training labels instead of the variance (σ²). This PR fixes the bug and adds a dedicated test file.Changes
skpro/regression/dummy.pyIn
_fit: Added storage ofself._var = np.var(y.values)alongside the existingself._sigma.In
_predict_var: Changed to useself._varinstead ofself._sigma.skpro/regression/tests/test_dummy.py(NEW)Added 5 targeted tests for
DummyProbaRegressor.predict_var:test_predict_var_equals_training_variance_empiricalnp.var(y_train)for'empirical'strategytest_predict_var_equals_training_variance_normalnp.var(y_train)for'normal'strategytest_predict_var_not_equal_stdtest_predict_var_is_nonnegativetest_predict_var_index_and_columnsX_test/y_trainAll 5 tests pass locally.
How to verify
Expected: 5 passed
Type of Change