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
Update clone()
for pipelines and components to copy over random state by default
#1753
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1753 +/- ##
=========================================
- Coverage 100.0% 100.0% -0.0%
=========================================
Files 247 247
Lines 19598 19574 -24
=========================================
- Hits 19589 19565 -24
Misses 9 9
Continue to review full report at Codecov.
|
@@ -440,27 +440,19 @@ def test_clone_init(): | |||
clf = MockFitComponent(**params) | |||
clf_clone = clf.clone() | |||
assert clf.parameters == clf_clone.parameters | |||
|
|||
|
|||
def test_clone_random_state(): |
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.
Don't need this test specifically anymore.
pipeline_clone = pipeline.clone(random_state=42) | ||
assert pipeline_clone.random_state == pipeline.random_state | ||
|
||
pipeline = linear_regression_pipeline_class(parameters=parameters, random_state=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.
Was duplicated checks? 🤔 Either way, not necessary anymore.
|
||
def test_nonlinear_clone_init(nonlinear_regression_pipeline_class): | ||
@pytest.mark.parametrize("is_linear", [True, False]) | ||
def test_clone_init(is_linear, linear_regression_pipeline_class, nonlinear_regression_pipeline_class): |
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.
Combined test_clone_init
and test_nonlinear_clone_init
via parametrize
|
||
def test_clone_fitted(X_y_binary, logistic_regression_binary_pipeline_class): | ||
@pytest.mark.parametrize("is_linear", [True, False]) | ||
def test_clone_fitted(is_linear, X_y_binary, logistic_regression_binary_pipeline_class, nonlinear_binary_pipeline_class): |
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.
Combined test_nonlinear_clone_fitted
and test_clone_fitted
via parametrize
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.
LGTM!
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 really like the subtractions in this PR. Very well done.
Closes #1340