MLE of lambda parameter in PowerTransform bijector
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python, tensorflow
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Bắt đầu bằng cách tái tạo vòng lặp huấn luyện PowerTransform và TransformedDistribution được cung cấp, sau đó so sánh xác suất log và Jacobian xuôi của nó với scipy.stats.boxcox tại các giá trị lambda được báo cáo. Xác định xem sự khác biệt xuất phát từ quy trình huấn luyện hay hành vi của PowerTransform; hoàn tất khi giải thích được sự không khớp hoặc xác định được một lỗi có thể tái hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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?
- Ngôn ngữ chính
- Jupyter Notebook
- Star
- 4.4k
- Fork
- 1.1k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của tensorflow/probability
-
KL divergence between two `TransformedDistribution`s with a shared non-injective bijector (`AbsoluteValue`) returns the base KLCó thể đã có người làm @Andreas-Hum đã nhận 8 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tensorflow/probability#2036 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
tensorflow/probability#2040 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
tensorflow/probability#2034 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
tensorflow/probability#2021 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
tensorflow/probability#2015 ·
Tất cả issue của tensorflow/probability
Issue tương tự
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Selectus2/trainers-rb#29 ·
-
test_issue1702 hardware test fails in a full `-m gpu` run: it reads a process-wide pinned-memory counter that test_issue1174 leaves non-zeroCó thể đã có người làm @jafarovvvvvvv đã nhận hôm nay. Đang mởbug claimed difficulty:2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
MakazhanAlpamys/Soup#2680 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
training
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
tinaudio/synth-setter#3758 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bot-triaged module: correctness (silent) module: data module: error checking triage review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
vllm-project/vllm-ascend#21392 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày