TST: enforce proper sklearn __init__ -- regressors - #114
Conversation
* Related to lanlgh-111, but only aims to address a subset of it. This is the regression equivalent to the classifier-based testing added in lanlgh-112. * Similar to that other PR, the regression test added here also causes a failure when introducing the API violation from lanl#70 (comment). * I did not use AI in the prepartion of this PR, though note that the original review comment that triggered all of this work was from the greptile AI reviewer on GitHub in lanlgh-70.
|
This PR is related to #112 Fixes #111 which together involves #112 and this PR In #112, we discussed with the scikit-learn, who were reluctant to add
As a result, I suggest the following code change Line 13 in +from gfdl.model import EnsembleGFDLClassifier, GFDLClassifier, GFDLRegressor
-from gfdl.model import EnsembleGFDLClassifier, GFDLClassifierLine 444 in + GFDLClassifier, EnsembleGFDLClassifier, GFDLRegressor
- GFDLClassifier, EnsembleGFDLClassifierI ran the following command: Before the change, 5533 tests passed and none failed. Next, I ran these commands on python -m venv gfdl_env
source ~/gfdl_env/bin/activate
cd GFDL
python -m pip install ".[test]"
python -m pytest src/gfdl/tests/test_model.py -k "test_preserve_class_inputs"These added tests passed before and after the suggested change |
|
The above solution is a simple addition to the test function's decorator. |
|
Simple concern as with the solution to #112 :
|
|
I don't think these review comments reflect the current design of the code base. Your review mostly focuses on confirming that the new test passes, but I don't see confirmation that the desired failure happens when you reintroduce the break we're trying to avoid in the first place? That's our main goal here, guarding against that. Agreed, I've adjusted my original PR description to auto-close the matching issue now that the classifier PR has been merged in. |
|
Ah, I see now that the Okay, the proposed change to the Next, as in #112, I changed + self.hidden_layer_sizes = np.asarray(hidden_layer_sizes)
- self.hidden_layer_sizes = hidden_layer_sizesand confirmed that the new test fails but that all other tests in Recall from discussion in #112 that the change to This is what motivated the new test. I approve of this PR if you @tylerjereddy are satisfied. |
Thanks, I think we're "ok" then if you don't see any problems. Feel free to merge. |
Fixes TST: enforce init/param mutability requirements for sklearn convention #111. This is the regression equivalent to the classifier-based testing added in TST: enforce proper
sklearn__init__for classifiers #112.Similar to that other PR, the regression test added here also causes a failure when introducing the API violation from WIP, ENH: Add support for gamma scaling and iterative solvers. #70 (comment).
I did not use AI in the prepartion of this PR, though note that the original review comment that triggered all of this work was from the greptile AI reviewer on GitHub in WIP, ENH: Add support for gamma scaling and iterative solvers. #70.