Skip to content

[MRG] Deprecated the rng_ attribute of GaussianProcessRegressor #8015

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
wants to merge 5 commits into from

Conversation

dalmia
Copy link
Contributor

@dalmia dalmia commented Dec 8, 2016

Reference Issue

Fixes #7752

What does this implement/fix? Explain your changes.

Adds the deprecation for rng_ to be kept only as a variable for fit

@property
@deprecated("Attribute ``rng_`` is deprecated in version 0.19 and will be"
" used only as a variable in version 0.21.")
def rng_(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no trailing underscore.

@@ -140,6 +141,12 @@ def __init__(self, kernel=None, alpha=1e-10,
self.copy_X_train = copy_X_train
self.random_state = random_state

@property
@deprecated("Attribute ``rng_`` is deprecated in version 0.19 and will be"
" used only as a variable in version 0.21.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very unclear for the user. Say "will be removed"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it from a developer point of view. But yes it would be unclear. Making the change.

@amueller
Copy link
Member

amueller commented Dec 8, 2016

LGTM once tests pass

@tguillemot
Copy link
Contributor

I know there is no standard way to do that in sklearn but it could be cool to add comment on how we clean the deprecation at 0.21. For example, in your case, you can add a comment saying :

# Deprecation 0.21
# Replace the above line by
# rng = check_random_state(self.random_state)

What do you think @amueller ?
LGTM if you're against.

@amueller
Copy link
Member

amueller commented Dec 9, 2016

usually it's relatively obvious what is to do. I'm not against adding the comment but I don't think it's that helpful.
If you can describe what needs to be done in two lines, then it was probably obvious in the first place.
You saw #7927. The tricky parts of that were the removal of accepting 1d X and removing class_weight="auto" I'm not sure if I would have been able to describe these in a sensible way.

In general, more documentation is better and this one doesn't really introduce any noise so I'd be good with it.

@dalmia
Copy link
Contributor Author

dalmia commented Dec 10, 2016

@amueller Please let me know if I need to do anything else.

@tguillemot
Copy link
Contributor

I'm not against adding the comment but I don't think it's that helpful.

I proposed that to simplify the future work but maybe it's not really necessary indeed :).

@dalmia Sorry for the delay on your PR.
+1

@dalmia
Copy link
Contributor Author

dalmia commented Dec 12, 2016

@tguillemot Not a problem. :)

@jnothman
Copy link
Member

Btw, this duplicates the work of #7846, and I think I'd rather see that merged in its entirety than to give @kiote merge conflicts.

@dalmia
Copy link
Contributor Author

dalmia commented Dec 12, 2016

I agree @jnothman, I'll close this then.

@dalmia dalmia closed this Dec 12, 2016
@dalmia dalmia deleted the 7752 branch January 4, 2017 03:19
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

Successfully merging this pull request may close these issues.

rng attribute is set in sklearn.gaussian_process.GaussianProcessRegressor at fit time
4 participants