`irls_solver` does not enforce `min_beta` when IRLS converges, and documents `max_beta`'s default as -30

Đang mở Phù hợp với người mới
#521 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

@aviralgarg05 đang làm issue này rồi.

Từ ngày 17/11/2026.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
bioinformatics

Hướng nghiên cứu

Bắt đầu tại glm.py:100, nơi quá trình hội tụ chuyển sang bộ tối ưu có ràng buộc với np.abs(beta_hat) > max_beta; hãy thay thế bằng kiểm tra đối với cả min_beta và max_beta. Chạy đoạn tái hiện từ issue để xác nhận LFC được clamp, sau đó sửa giá trị mặc định bị in sai tại glm.py:49 và inference.py:75. Kiểm tra các test GLM hiện có để tìm chỗ thêm một ca regression cho các biên không đối xứng.

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

Mô tả

bug

irls_solver hands over to the bounded optimizer only when a coefficient exceeds max_beta in absolute value, so with bounds that are not symmetric IRLS can converge below min_beta: min_beta=-2 returns an LFC of -3.1146 with converged=True; the docstrings of irls_solver, Inference.irls and DefaultInference.irls call min_beta the "Lower-bound on LFC" (and give max_beta's default as -30, where it is 30).
The default bounds, -30 and 30, are symmetric and not affected. glm.py:100 tests np.abs(beta_hat) > max_beta; testing (beta_hat < min_beta) | (beta_hat > max_beta) would apply both bounds, and the default is misprinted at glm.py:49 and inference.py:75.

Source line numbers refer to commit 2ca3b74.

Reproduction
import numpy as np
from pydeseq2.glm import irls_solver
size_factors = np.array([0.8, 1.2, 1.0, 0.9, 1.1, 1.05])
design = np.column_stack([np.ones(6), [0, 0, 0, 1, 1, 1]])
counts = np.array([48, 55, 50, 2, 3, 2])
beta, mu, hat, converged = irls_solver(counts, size_factors, design, 0.05, min_beta=-2, max_beta=30)
print("beta", beta.round(4), "converged", converged)
print([line.strip() for line in irls_solver.__doc__.splitlines() if "Upper-bound" in line])

Expected: an LFC no lower than -2, and a default of 30 in the docstring.

Actual, with PyDESeq2 0.6.0:

beta [ 3.9448 -3.1146] converged True
['Upper-bound on LFC. (default: ``-30``).']

Split out from #491.

Ngôn ngữ chính
Python
Star
770
Fork
98
Merge trung bình
19 giờ 55 phút
Pull request đã merge (30 ngày)
45

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 scverse/PyDESeq2

Tất cả issue của scverse/PyDESeq2

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.