wrong batch_shape of distribution for observation distribution in HMM
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
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- machine-learning
Hướng nghiên cứu
Bắt đầu với hành vi batch_shape và event_shape của tfd.Mixture, tfd.MixtureSameFamily và tfd.HiddenMarkovModel được thể hiện trong issue. So sánh các shape của tham số thành phần và tham số categorical với các yêu cầu của phân phối chuyển tiếp HMM. Được xem là hoàn tất khi xác định được một shape phân phối quan sát hợp lệ biểu diễn cả hai trạng thái ẩn mà không gặp các lỗi scalar-batch hoặc last-dimension đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I got a serial of observations with shape of (N, 1). These observations correspond to two hidden states.
For hidden state 0, I declare the distribution as below:
dis0 = tfd.MixtureSameFamily(
mixture_distribution=tfd.Categorical(probs=[0.4, 0.4, 0.2]), # mixture_distribution=tfd.Categorical(probs=[0.4, 0.4, 0.2])
components_distribution=tfd.Normal(loc=tf.Variable([100.0, 260.0, 180.0], trainable=True), scale=tf.Variable([10.0], trainable=True)) # tfd.Normal(loc=[100, 260, 180], scale=[10, 10, 10])
)
which mean it's a mixed Normal Distribution with three peaks.
For hidden. state 1, I declare the distribution as below:
dis1 = tfd.Normal(loc=tf.Variable(0.0, trainable=True), scale=tf.Variable(40.0, trainable=True))
which means it's a simple Normal Distribution
then I declare the 'observation distribution' as :
observation_distribution = tfd.Mixture(
cat=tfd.Categorical(probs=[0.9, 0.1]), # 对应两个状态的概率
components=[dis_0, dis_1]
)
After running the above code, I got observation_distribution.batch_shape = []
Even if I adjust the code as below:
`dis_swim = tfd.MixtureSameFamily(
mixture_distribution=tfd.Categorical(probs=[[0.4, 0.4, 0.2]]), # mixture_distribution=tfd.Categorical(probs=[0.4, 0.4, 0.2])
components_distribution=tfd.Normal(loc=tf.Variable([100.0, 260.0, 180.0], trainable=True), scale=tf.Variable([10.0], trainable=True)) # tfd.Normal(loc=[100, 260, 180], scale=[10, 10, 10])
)
dis_turn = tfd.Normal(loc=tf.Variable([0.0], trainable=True), scale=tf.Variable([40.0], trainable=True))
print(dis_turn.batch_shape, dis_turn.event_shape)
observation_distribution = tfd.Mixture(
cat=tfd.Categorical(probs=[[0.9, 0.1]]), # 对应两个状态的概率
components=[dis_swim, dis_turn]
)`
I got observation_distribution.batch_shape = [1]
!!!
However, the observation distribution in HMM needs batch_size equals 2 when I definate the HMM model as below:
hmm = tfd.HiddenMarkovModel(
initial_distribution=tfd.Categorical(probs=[0.5, 0.5]),
transition_distribution=tfd.Categorical(probs=[[0.9, 0.1], [0.1, 0.9]]),
observation_distribution=observation_distribution,
num_steps=N)
so I got the error "observation_distribution can't have scalar batches" or "transition_distribution and observation_distribution must agree on last dimension of batch size"
Is there anyone could introduct me to fix my code?
PS: Tensorflow:2.17.0 Tensorflow-probability 0.24.0
- 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ó 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 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
tensorflow/probability#2013 ·
Tất cả issue của tensorflow/probability
Issue tương tự
-
[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 failsCó thể đã có người làm @vrjdev đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
DoubleML/doubleml-for-py#455 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Install page: spectarf's CUDA engine fails with PyTorch for CUDA 13.0 (nvvmError: ERROR_INVALID_IR)Có thể đã có người làm @lukepolson đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
PyTomography/PyTomography#435 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
beginner friendly
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
aws-samples/sample-per-model-bedrock#821 ·
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 72/100
instadeepai/InstaNovo-FM#50 ·