Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

New (optional) demeaning backend via `within`

オープン
#714 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
python
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
1.1k
フォーク
203
平均マージ
3時間 26分
マージ済み PR(30日)
115

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

bashtage/linearmodels のほかの issue

bashtage/linearmodels の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。