MLE of lambda parameter in PowerTransform bijector
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- python, tensorflow
調査の方向性
まず、提供されている PowerTransform と TransformedDistribution のトレーニングループを再現し、次に、報告されている lambda 値で、その対数確率と順方向の Jacobian を scipy.stats.boxcox と比較します。相違がトレーニング手順に由来するのか、PowerTransform の動作に由来するのかを特定します。相違を説明するか、再現可能な不具合を特定できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi everyone, I'm trying tofind the optimal lambda parameter of the PowerTransform bijector with maximum lilkelihood estimation.
In order to do so I had to modify the constructor of the bijector in order to allow power to be a trainable tf.Variable.
Then code is the following:
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from tensorflow_probability import bijectors as tfb
from tensorflow_probability import distributions as tfd
from scipy.stats import boxcox
np.random.seed(42)
tf.random.set_seed(42)
# Data exponential generation
data_dist = tfd.Sample(tfd.Exponential(1.), sample_shape=1000)
x_train = data_dist.sample()
plt.hist(x_train.numpy(), bins=120, density=True, alpha=0.6, color='blue', label='Samples')
plt.show()
nf = tfd.TransformedDistribution(
tfd.Normal(loc=0, scale=1),
bijector=tfb.PowerTransform(power=tf.Variable(initial_value=1., name='power'))
)
# Training loop
num_steps = 2000
optimizer = tf.keras.optimizers.Adam(learning_rate=0.001)
for step in range(num_steps):
with tf.GradientTape() as tape:
loss = -tf.reduce_sum(nf.log_prob(x_train))
grads = tape.gradient(loss, nf.trainable_variables)
optimizer.apply_gradients(zip(grads, nf.trainable_variables))
if step % 100 == 0:
print(f"Step {step}, Loss: {loss.numpy()}, Grads: {grads}, Power: {nf.trainable_variables[0].numpy()}")
_, llm_lmbda = boxcox(x_train, lmbda=None)
print(f"Scipy MLE power is: {llm_lmbda}") # 0.24647694003577084
print(f"My MLE power is: {nf.trainable_variables[0].numpy()}") # 0.6407918334007263
z_samples = nf.sample(1000)
plt.hist(z_samples.numpy(), bins=120, density=True, alpha=0.6, color='green', label='Samples')
plt.show()
The estimation with the MLE from the scipy library gives lambda = 0.25 but mine gives lambda = 0.64. If I use the bijector with a static value of 0.25 I can recover a distribution that is closer to the original exponential so I believe that there might be a problem with the training procedure or with the computation of the forward Jacobian in the PowerTransform bijector but I can't find it.
Anyone can help with this?
- 主要言語
- 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 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 54/100
tensorflow/probability#2040 ·
-
難易度 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 ·
tensorflow/probability の issue をすべて見る
似ている issue
-
training
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
tinaudio/synth-setter#3758 ·
メンテナーはふだん 1 日以内に返信
-
bot-triaged module: correctness (silent) module: data module: error checking triage review
難易度 2/5 1〜3時間 初心者へのやさしさ 71/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
vllm-project/vllm-ascend#21392 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信