Set cv_score to -np.inf
if OLS fit fails
#640
Open
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 PR will automatically set the cross-validation score of an ordinary least-squares fit to
-np.inf
whenever the fit fails during sequential feature selection.This ensures that whenever a least-squares fit fails, it does not fail the entire regression process, but simply goes to the next one (after all, if a fit fails, it simply means that that fit is terrible and should never be used, not that no fit ever will work).
Also, I made the modification in
master
, simply because it is a one-liner and I will be deleting the fork anyways afterward.I can add the change to the
CHANGELOG
is required of course.Pull Request Checklist
./docs/sources/CHANGELOG.md
file (if applicable)./mlxtend/*/tests
directories (if applicable)mlxtend/docs/sources/
(if applicable)PYTHONPATH='.' pytest ./mlxtend -sv
and make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g.,PYTHONPATH='.' pytest ./mlxtend/classifier/tests/test_stacking_cv_classifier.py -sv
)flake8 ./mlxtend