Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TransformedTargetRegressor forces fitting #15310

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

Closed
mikkelam opened this issue Oct 21, 2019 · 2 comments
Closed

TransformedTargetRegressor forces fitting #15310

mikkelam opened this issue Oct 21, 2019 · 2 comments

Comments

@mikkelam
Copy link

mikkelam commented Oct 21, 2019

Description

It's simple, the TransformedTargetRegressor forces you to fit. I'm in a scenario where i want to multiply the outputted value by some number, but i don't want to check my test scores with the transformed targets, so when deploying my model I wrap it in TransformedTargetRegressor.

Yet, that forces me to fit, my transformer and my estimator (which they already are). Does it make sense to allow this use case? It seems weird that the implementation doesn't check if the regressor and transformer themselves are fitted but only checks if they are set

Steps/Code to Reproduce

    target = TransformedTargetRegressor(transformer=multiplier, regressor=fit_regressor)
    # target.predict(..) now fails

    # my workaround
    target.regressor_ = fit_regressor  # otherwise check_is_fitted fails (╯°□°)╯︵ ┻━┻
    target.transformer_ = multiplier  # same as above
    target._training_dim = 2 # column vector for regression

Thanks for your awesome project!

EDIT: had to add the training dim as well

@glemaitre
Copy link
Member

This is related with the API issue/enhancement proposed in #8370 where we want to freeze the estimator such that fit does nothing.

@mikkelam
Copy link
Author

Ah that looks like a great suggestion. I will close this issue then

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

2 participants