Make seed = I(FALSE) escalate to an error if RNG was used
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 38/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- r
調査の方向性
ファイルやテストは指定されていません。まず、future() の seed 引数と既存の future.rng.onMisuse の処理を追跡し、呼び出しごとの重大度を指定する提案された形式を比較して、seed=FALSE およびグローバルオプションとの互換性を定義してください。選択した動作が仕様化され、テストによって検証されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Currently, the default behavior of declaring use of the random number generator (RNG) is seed = FALSE, which triggers a warning if it detects that the future did indeed use the RNG despite not declaring so;
library(future)
f <- future(sample.int(3)) ## defaults to seed = FALSE
v <- value(f)
v
#> [1] 3 2 1
#> Warning message:
#> UNRELIABLE VALUE: Future (<unnamed-1>) unexpectedly generated random numbers without specifying argument 'seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced. To disable this check, use 'seed=NULL', or set option 'future.rng.onMisuse' to "ignore". [future <unnamed-1> (54b70f088e2c65b835aea5f0cd100eff-1); on 54b70f088e2c65b835aea5f0cd100eff@hb-x1-2023<867157>]
We can escalate these type of warnings to errors globally by setting R option future.rng.onMisuse as in:
library(future)
options(future.rng.onMisuse = "error")
f <- future(sample.int(3))
v <- value(f)
#> Error: UNRELIABLE VALUE: Future (<unnamed-2>) unexpectedly generated random numbers without specifying argument 'seed'. There is a risk that those random numbers are not statistically sound and the overall results might be invalid. To fix this, specify 'seed=TRUE'. This ensures that proper, parallel-safe random numbers are produced. To disable this check, use 'seed=NULL', or set option 'future.rng.onMisuse' to "ignore". [future <unnamed-2> (54b70f088e2c65b835aea5f0cd100eff-2); on 54b70f088e2c65b835aea5f0cd100eff@hb-x1-2023<867157>]
The problem with this approach is that options are global and affects all codes, even where we don't want a strict check. Also,none of the future R options should be set developers - only end-users for troubleshooting etc. One can of course set options temporarily to control this, but it adds clutter and is error prone.
A better way to give the developer control of the severity of RNG misuse is via the seed argument itself. Here are a few approaches:
seed = structure(FALSE, onMisuse = "error")seed = I(FALSE)- "as-is"
We could also move towards making seed = FALSE be strict and give an error, and seed = NA to be the current soft warning. However, such a migration is a much bigger task given that we'll break some existing code.
- 主要言語
- R
- スター
- 1k
- フォーク
- 94
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
futureverse/future のほかの issue
-
The first code example in the README does not work対応中かも @sean0407 が 13 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
futureverse/future#838 · コメント 1 件 · リアクション 1 件 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
futureverse/future#833 ·
-
feature/resources RNG
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
futureverse/future#832 ·
-
feature request
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
futureverse/future#822 · リアクション 1 件 ·
-
documentation
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
futureverse/future#818 · コメント 4 件 ·
futureverse/future の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
beginner-task
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Rdatatable/data.table#7948 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
datacarpentry/semester-biology#1294 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
plot_components fails for logistic models with minmax scaling and no floor対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 4 日以内に返信