Numba multivariate_normal raises LinAlgError on a NaN covariance

Đang mở
#2,576 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
numpy, python
Lĩnh vực
backend, machine-learning

Hướng nghiên cứu

Start by reading the Numba dispatch for pt.random.multivariate_normal and the Numba linalg Ops for SVD, eigenvalue decomposition, and Cholesky; compare their behavior on the NaN covariance shown in the issue with the JAX and Python backends. Check the existing tests for these methods and backends. Done means the Numba behavior matches the expected NaN results for each method without breaking finite covariance cases.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

linalg numba random variables

pt.random.multivariate_normal raises LinAlgError under the numba backend when its covariance contains NaN, for every method. JAX returns NaN draws, and so do the numba linalg Ops on the same input. The numba dispatch factors the covariance with numba's np.linalg.svd, eigh or cholesky, which raise on non-finite input. The Python backend follows numpy, which raises for svd and cholesky and returns NaN for eigh.

import numpy as np
import pytensor
import pytensor.tensor as pt

cov = pt.matrix("cov")
nan_cov = np.full((2, 2), np.nan)

for method in ["svd", "eigh", "cholesky"]:
    draw = pt.random.multivariate_normal(np.zeros(2), cov, method=method)
    print(pytensor.function([cov], draw, mode="JAX")(nan_cov))  # [nan nan]
    pytensor.function([cov], draw, mode="NUMBA")(nan_cov)  # LinAlgError

print(pytensor.function([cov], pt.linalg.svd(cov, compute_uv=False), mode="NUMBA")(nan_cov))  # [nan nan]
Ngôn ngữ chính
Python
Star
654
Fork
258
Merge trung bình
3 ngày 41 phút
Pull request đã merge (30 ngày)
42

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pymc-devs/pytensor

Tất cả issue của pymc-devs/pytensor

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.