`JointDistributionCoroutineAutoBatched` seed behaviour with batches
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- jupyter-notebook, python, tensorflow
調査の方向性
まず、リンクされている Colab または model_autobatched のサンプルと sample_distributions の呼び出しを、JAX バックエンドおよびベクトル化された theta サンプルで実行します。JointDistributionCoroutineAutoBatched のサンプリングと seed の処理を追跡します。完了条件は、theta バッチ全体で y の独立したドローが行われ、sample_distributions でサポートされていない object-to-Tensor 変換が発生しないことです。
索引モデルが issue の本文から書いたものです。
説明
Hi all,
I'm trying to compute a posterior predictive distribution over samples from a posterior distribution (Colab here). TFP 0.25 with JAX backend.
My (mre and therefore contrived) model specification is
@tfd.JointDistributionCoroutineAutoBatched
def model_autobatched():
theta = yield tfd.Normal(loc=0., scale=1., name="theta")
yield tfd.Normal(loc=theta, scale=0.1, name="y")
i.e. a Normally-distributed observation model with Normally-distributed mean. To compute the posterior predictive distribution, I wish to sample the y component conditional on a vector of theta samples.
theta_samples = np.arange(5.)
model_autobatched.sample(theta=theta_samples, seed=jax.random.key(0))
giving
StructTuple(
theta=Array([0., 1., 2., 3., 4.], dtype=float32),
y=Array([0.06215769, 1.0621576 , 2.0621576 , 3.0621576 , 4.0621576 ], dtype=float32)
)
Oh dear, we notice that y - theta = constant. This seems to suggest that a single PRNG key is being used for each draw of y given the sample from theta.
Moreover, this approach fails entirely if sample_distributions is called.
model_autobatched.sample_distributions(theta=theta_samples, seed=jax.random.key(0))
ValueError: Attempt to convert a value (<object object at 0x7a53561590d0>) with an unsupported type (<class 'object'>) to a Tensor.
As a workaround, we could use the older JointDistributionCoroutine with Root annotation which works as desired (see Colab)
[edit] actually, JDCoroutine/Root only works because the whole theta vector is passed to y's constructor, not vectorisation over the whole model.
Do we have a bug or a feature, I wonder?
Regards,
Chris
- 主要言語
- Jupyter Notebook
- スター
- 4.4k
- フォーク
- 1.1k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tensorflow/probability のほかの issue
-
KL divergence between two `TransformedDistribution`s with a shared non-injective bijector (`AbsoluteValue`) returns the base KL対応中かも @Andreas-Hum が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tensorflow/probability#2036 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
tensorflow/probability#2034 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
tensorflow/probability#2021 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
tensorflow/probability#2015 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
tensorflow/probability#2013 ·
tensorflow/probability の issue をすべて見る
似ている issue
-
[Bug]: DoubleMLRDDData accepts a score_col that is no data column (as in its docstring example); the running variable then becomes a covariate and RDFlex fails対応中かも @vrjdev が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DoubleML/doubleml-for-py#455 ·
メンテナーはふだん 1 日以内に返信
-
Install page: spectarf's CUDA engine fails with PyTorch for CUDA 13.0 (nvvmError: ERROR_INVALID_IR)対応中かも @lukepolson が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
PyTomography/PyTomography#435 ·
メンテナーはふだん 1 日以内に返信
-
beginner friendly
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
aws-samples/sample-per-model-bedrock#821 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
instadeepai/InstaNovo-FM#50 ·