Skip to content

handle singular covariance matrix in density calculation#808

Merged
mschwoer merged 1 commit intomainfrom
fix_linalgerror
Apr 2, 2026
Merged

handle singular covariance matrix in density calculation#808
mschwoer merged 1 commit intomainfrom
fix_linalgerror

Conversation

@mschwoer
Copy link
Copy Markdown
Collaborator

Fixes AX-79

@mschwoer mschwoer requested a review from GeorgWa March 19, 2026 10:35
z = gaussian_kde(xy, bw_method=bw_method)(xy)
except np.linalg.LinAlgError:
# Singular covariance matrix when data has near-zero variance in one dimension
axis.scatter(x, y, s=s, **kwargs)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we plot in this case but not the other? Is it for debugging?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we do also plot if nothing it thrown (l. 89)

@mschwoer mschwoer merged commit 631f88f into main Apr 2, 2026
7 checks passed
@mschwoer mschwoer deleted the fix_linalgerror branch April 2, 2026 08:50
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.

2 participants