-
-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
[MRG+2] DOC correct docstring for sample_gaussian #6957
Conversation
@kwohlfahrt Thanks. |
Ah. It looks to me like the replacement does not allow for different covariances, is that correct? |
Indeed you right. I thought that |
LGTM. |
@@ -64,7 +64,8 @@ def log_multivariate_normal_density(X, means, covars, covariance_type='diag'): | |||
return log_multivariate_normal_density_dict[covariance_type]( | |||
X, means, covars) | |||
|
|||
|
|||
@deprecated("The class function sample_gaussian is deprecated and " | |||
"will be removed in 0.20. Use numpy.multivariate_normal instead.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you deprecate a function you need to remove it from everywhere. is this used somewhere? otherwsie the test suite will throw a lot of deprecation warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the logs, there is only one test which uses it, test_sample_gaussian
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do git grep sample_gaussian, you'll see that the class _GMM uses it.
So we need to create a _sample_gaussian function.
@agramfort Sorry I've forgot that. It will solve any problems until we remove completely the old GMM classes. |
sounds like a plan
|
With |
OK. Should the tests that test |
Yes On Thu, Jul 7, 2016 at 7:14 PM +0200, "Kai" [email protected] wrote: OK. Should the tests that test sample_gaussian directly be moved to the new function as well? — |
@@ -64,7 +64,8 @@ def log_multivariate_normal_density(X, means, covars, covariance_type='diag'): | |||
return log_multivariate_normal_density_dict[covariance_type]( | |||
X, means, covars) | |||
|
|||
|
|||
@deprecated("The function sample_gaussian is deprecated and " | |||
"will be removed in 0.20. Use numpy.multivariate_normal instead.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it's numpy.random.multivariate_normal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it's numpy.random.multivariate_normal
.
CIs are not happy |
You have three other things to change in
|
I think the appveyor failure is unrelated but to be sure can you do |
@@ -64,7 +64,9 @@ def log_multivariate_normal_density(X, means, covars, covariance_type='diag'): | |||
return log_multivariate_normal_density_dict[covariance_type]( | |||
X, means, covars) | |||
|
|||
|
|||
@deprecated("The function sample_gaussian is deprecated and " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the version they were deprecated in to the message (was deprecated in 0.18)
LGTM apart from adding the deprecation version. This was not superseded by #7012, was it? |
@amueller No as @kwohlfahrt was working on it I didn't want to remove his work. |
Docstring did not match function behaviour. Caused some trouble trying to implement a compatible version for a different distribution.
This avoids triggering the deprecation warning. sample_gaussian is just a thin wrapper.
_sample_gaussian is not publicly exported in mixture, so use gmm module.
Hi all, sorry I dropped this for so long. Rebased and fixed the tests, so if you still want to merge go ahead! |
lgtm. @tguillemot ? |
@tguillemot good to merge? |
LGTM. Sorry for the delay. |
Thanks @kwohlfahrt |
* DOC correct docstring for sample_gaussian Docstring did not match function behaviour. Caused some trouble trying to implement a compatible version for a different distribution. * MAINT Use _sample_gaussian internally This avoids triggering the deprecation warning. sample_gaussian is just a thin wrapper. * Fix _sample_gaussian test path _sample_gaussian is not publicly exported in mixture, so use gmm module.
* DOC correct docstring for sample_gaussian Docstring did not match function behaviour. Caused some trouble trying to implement a compatible version for a different distribution. * MAINT Use _sample_gaussian internally This avoids triggering the deprecation warning. sample_gaussian is just a thin wrapper. * Fix _sample_gaussian test path _sample_gaussian is not publicly exported in mixture, so use gmm module.
* DOC correct docstring for sample_gaussian Docstring did not match function behaviour. Caused some trouble trying to implement a compatible version for a different distribution. * MAINT Use _sample_gaussian internally This avoids triggering the deprecation warning. sample_gaussian is just a thin wrapper. * Fix _sample_gaussian test path _sample_gaussian is not publicly exported in mixture, so use gmm module.
* DOC correct docstring for sample_gaussian Docstring did not match function behaviour. Caused some trouble trying to implement a compatible version for a different distribution. * MAINT Use _sample_gaussian internally This avoids triggering the deprecation warning. sample_gaussian is just a thin wrapper. * Fix _sample_gaussian test path _sample_gaussian is not publicly exported in mixture, so use gmm module.
Reference Issue
None.
What does this implement/fix? Explain your changes.
Docstring for
sklearn.mixture.sample_gaussian
did not match function behaviour. Caused some trouble trying to implement a compatible version for a different distribution. Corrects this for future reference.