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

Skip to content

Kde doc fix #11275

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

Merged
merged 2 commits into from
Sep 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions sklearn/neighbors/kde.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def score_samples(self, X):
Returns
-------
density : ndarray, shape (n_samples,)
The array of log(density) evaluations.
The array of log(density) evaluations. These are normalized to be
probability densities, so values will be low for high-dimensional
data.
"""
# The returned density is normalized to the number of points.
# For it to be a probability, we must scale it. For this reason
Expand All @@ -159,7 +161,7 @@ def score_samples(self, X):
return log_density

def score(self, X, y=None):
"""Compute the total log probability under the model.
"""Compute the total log probability density under the model.

Parameters
----------
Expand All @@ -170,7 +172,9 @@ def score(self, X, y=None):
Returns
-------
logprob : float
Total log-likelihood of the data in X.
Total log-likelihood of the data in X. This is normalized to be a
probability density, so the value will be low for high-dimensional
data.
"""
return np.sum(self.score_samples(X))

Expand Down