NA dimensions for complex and tuple types
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
tests/testthat/resources/stan/parameter_types で再現から始め、示されている $draws(format = "df") と $metadata() の呼び出しを実行します。variable_dims(metadata$variables) を追跡して、複雑な変数とタプル変数がどのように解析されるかを確認します。報告されるサイズが正しく、NA の強制変換に関する警告が表示されなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
When calling $draws() on a fit object whose model has complex or tuple types in it I receive warning messages about NA's being made for the variable sizes.
To Reproduce
I made the stan program below to test this
parameters {
real real_p;
vector[2] vector_p;
matrix[2, 2] matrix_p;
array[2] matrix[2, 2] array_matrix_p;
corr_matrix[2] corr_p;
complex complex_p;
complex_matrix[2, 2] complex_matrix_p;
complex_vector[4] complex_vector_p;
tuple(real, vector[3], array[2] matrix[2, 2], complex) tuple_int_vector_arraymatrix_complex_p;
array[2] tuple(real, tuple(vector[2], array[2] tuple(real, complex, matrix[2, 2]))) arraytuple_big_p;
}
You can get the error with the following
# I put this in the tests/testthat/resources/stan folder
mod_params <- testing_model("parameter_types")
fit <- mod_params$pathfinder(data=data_list, seed=1234, refresh = 0)
foo = fit$draws(format = "df")
# Warning messages:
# 1: In variable_dims(metadata$variables) : NAs introduced by coercion
# 2: In variable_dims(metadata$variables) : NAs introduced by coercion
# 3: In variable_dims(metadata$variables) : NAs introduced by coercion
# 4: In variable_dims(metadata$variables) : NAs introduced by coercion
# 5: In variable_dims(metadata$variables) : NAs introduced by coercion
meta = fit$metadata()
meta$stan_variable_sizes
## Output
$lp_approx__
[1] 1
$lp__
[1] 1
$real_p
[1] 1
$vector_p
[1] 2
$matrix_p
[1] 2 2
$array_matrix_p
[1] 2 2 2
$corr_p
[1] 2 2
$complex_p
[1] NA
$complex_matrix_p
[1] 2 2 NA
$complex_vector_p
[1] 4 NA
$`tuple_int_vector_arraymatrix_complex_p:1`
[1] 1
$`tuple_int_vector_arraymatrix_complex_p:2`
[1] 3
$`tuple_int_vector_arraymatrix_complex_p:3`
[1] 2 2 2
$`tuple_int_vector_arraymatrix_complex_p:4`
[1] NA
$arraytuple_big_p
[1] NA NA 2 2
Expected behavior
Tuples and complex types would have the correct size
Operating system
Linux redhat
CmdStanR version number
master 28329d7
Additional context
I found this while working on the functions for adding pathfinder types
- 主要言語
- R
- スター
- 161
- フォーク
- 69
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 47
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
stan-dev/cmdstanr のほかの issue
-
internal-code
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
stan-dev/cmdstanr#506 · コメント 7 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
stan-dev/cmdstanr#1314 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
Let fits compress their own output CSVs対応中かも @VisruthSK が 12 日前に担当しました。 オープンfeature
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
stan-dev/cmdstanr#1276 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
メンテナーはふだん 1 日以内に返信
stan-dev/cmdstanr の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
lrberge/fixest#686 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
ai-discovered area: data explorer
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
posit-dev/positron#16530 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信