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

Skip to content

KernelDensity and GMM interfaces are unnecessarily confusing #4062

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
jakevdp opened this issue Jan 8, 2015 · 8 comments
Closed

KernelDensity and GMM interfaces are unnecessarily confusing #4062

jakevdp opened this issue Jan 8, 2015 · 8 comments
Labels
Enhancement Needs Decision - Close Requires decision for closing

Comments

@jakevdp
Copy link
Member

jakevdp commented Jan 8, 2015

To evaluate the density of data at x, the current interface is density = np.exp(kde.score_samples(data))

(see in action here)

This seems really silly and unnecessary for such a common operation.

How would people feel about adding a density method to KernelDensity and to GMM to make this easier for users to figure out?

@amueller
Copy link
Member

amueller commented Jan 8, 2015

I am surprised, I would have assumed that function to give back probabilities.
Are there more functions with a similar interface? maybe the outlier detection?

I'm not a huge fan of adding more methods but density seems reasonable.

@jakevdp
Copy link
Member Author

jakevdp commented Jan 8, 2015

My opinion is that we should add a DensityEstimator base class or mixin for all the classes which act as density estimators to provide this type of interface.
It would also help with the stalled generative classifier PR that I have going somewhere...

@amueller
Copy link
Member

amueller commented Jan 8, 2015

Do you have a link?
There are only two density estimators at the moment, right?

@jakevdp
Copy link
Member Author

jakevdp commented Jan 8, 2015

Here's the PR: #2468

It's held-up because I can't figure out a good interface to set hyperparameters of individual fits. But you'll see in the code that there's some hacking required because of the nonuniformity of the current interfaces between KernelDensity and GMM.

@amueller amueller added this to the 0.16 milestone Jan 16, 2015
@amueller amueller modified the milestones: 0.16, 0.17 Sep 11, 2015
@amueller amueller modified the milestones: 0.18, 0.17 Sep 20, 2015
@amueller amueller modified the milestones: 0.18, 0.19 Sep 22, 2016
@amueller amueller modified the milestone: 0.19 Jun 12, 2017
@jnothman
Copy link
Member

Could we confirm here whether the new GMM implementations do this right?

@lesteve
Copy link
Member

lesteve commented Jun 15, 2017

cc @tguillemot

@tguillemot
Copy link
Contributor

GaussianMixture inherits from the DensityMixin base class but do not have a density function ( see mixture/base.py).

@cmarmo cmarmo added the Needs Decision - Close Requires decision for closing label Dec 13, 2021
@adrinjalali
Copy link
Member

It seems a pull request simply adding density to those classes would be welcome, and otherwise related discussions have been either moved to other repos or out of scope due to API limitations. Closing this one, while happy to review such a small PR for density.

@adrinjalali adrinjalali closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs Decision - Close Requires decision for closing
Projects
None yet
Development

No branches or pull requests

7 participants