Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a43eeb2

Browse filesBrowse files
committed
Simplify with math.log
1 parent c232e39 commit a43eeb2
Copy full SHA for a43eeb2

File tree

Expand file treeCollapse file tree

1 file changed

+1
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-8
lines changed

‎sklearn/mixture/_gaussian_mixture.py

Copy file name to clipboardExpand all lines: sklearn/mixture/_gaussian_mixture.py
+1-8Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,7 @@ def _estimate_log_gaussian_prob(X, means, precisions_chol, covariance_type, xp=N
561561
)
562562
# Since we are using the precision of the Cholesky decomposition,
563563
# `- 0.5 * log_det_precision` becomes `+ log_det_precision_chol`
564-
return (
565-
-0.5
566-
* (
567-
n_features * xp.log(xp.asarray(2 * xp.pi, dtype=X.dtype, device=device_))
568-
+ log_prob
569-
)
570-
+ log_det
571-
)
564+
return -0.5 * (n_features * math.log(2 * xp.pi) + log_prob) + log_det
572565

573566

574567
class GaussianMixture(BaseMixture):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.