Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

New (optional) demeaning backend via `within`

Đang mở
#714 2 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ó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Start by reading the AbsoringLS backend and the linked within solver documentation to understand the existing demeaning path and the proposed solver. The issue does not specify integration details or tests; done would mean an agreed, optional backend is implemented and validated against the existing behavior.

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

Mô tả

Hi @bashtage,

Over the last couple of months, we (mostly @schroedk) have spent quite a bit of time developing a faster demeaning algorithm for fixed effects regression that works particularly well for poorly-connected fixed effects (as e.g. in worker firm panels with little mobility). The core idea is to replace the diagonal preconditioner that linearmodels current LSMR implementation uses with an additive Schwarz preconditioner.

For some fixed effects structures, this new preconditioner works much better than diagonal LSMR:

Image

We have Python bindings published to PyPi as within_py that has a pretty simple API. Here is how you'd fit a simple FWL problem:

beta_true = np.array([1.0, -2.0, 0.5])
X = np.random.randn(n, 3)
y = X @ beta_true + np.random.randn(n)

result = solve_batch(fe, np.column_stack([y, X]))
y_tilde, X_tilde = result.demeaned[:, 0], result.demeaned[:, 1:]
beta_hat = np.linalg.lstsq(X_tilde, y_tilde, rcond=None)[0]
print(np.round(beta_hat, 4))  # [ 0.9982 -2.006   0.5005]

If you are curious how the solver works, we have written up details here and here.

Would you be interested to try this out as a second, optional solver for the AbsoringLS backend? If yes, I'd set up a draft PR in the next days / weeks.

Best, Alex

Ngôn ngữ chính
Python
Star
1.1k
Fork
203
Merge trung bình
3 giờ 26 phút
Pull request đã merge (30 ngày)
115

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 bashtage/linearmodels

Tất cả issue của bashtage/linearmodels

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.