Skip to content
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

ensure that all attributes with trailing underscore in fit are leared after the entire logic has succeded #586

Open
solegalli opened this issue Jan 10, 2023 · 0 comments

Comments

@solegalli
Copy link
Collaborator

solegalli commented Jan 10, 2023

All attributes with trailing underscore must be set up at the end of the fit() functionality, when we are sure that all fit logic worked. At the moment, it is not like that for all transformers.

Add a test like the one in test_encoders:

@pytest.mark.parametrize("estimator", _estimators)
def test_raises_non_fitted_error_when_error_during_fit(estimator):
    X, y = test_df(categorical=True)
    X.loc[len(X) - 1] = nan
    transformer = clone(estimator)

    with pytest.raises(ValueError):
        transformer.fit(X, y)

    # Test when fit is not called prior to transform.
    with pytest.raises(NotFittedError):
        transformer.transform(X)

Modules encoding and preprocessing already have this functionality.

@solegalli solegalli changed the title test that if fit fails, then the transformer also fails the non_fitted_error ensure that all attributes with trailing underscore in fit are leared after the entire logic has succeded Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant