Could `make_strata()` warn (or remove the `strata` attribute) when only returning a single strata? Or message when pooling at all?
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- r
- 領域
- testing-qa
調査の方向性
Start with make_strata() and its vfold_cv() caller, focusing on how a single stratum, pooled categories, and the strata attribute are represented. Review the existing behavior and tests, then resolve whether completion means warning, removing the attribute, reporting pooled categories, or a documented combination.
索引モデルが issue の本文から書いたものです。
説明
Feature
I was reminded about #438 by the GitHub lock bot, an issue where a user was surprised that vfold_cv() (and eventually make_strata()) "didn't stratify" (or rather, treated the data as only having one stratum) when the stratification variable only had one class above the pooling threshold.
I think rsample is doing the right thing here, and behaving as documented, but this behavior is still a bit surprising. Would it be possible for make_strata() to warn when it only returns a single stratum? I imagine this is almost always unintentional, as users wouldn't specify a stratification variable if they thought it would go unused.
Another consideration here is that, even if only one stratum is created, the rset objects still contain a strata attribute. As a result, when printed these objects claim that they were created "using stratification":
data.frame(
x = rnorm(100),
y = c(rep("a", 99), "b")
) |>
rsample::vfold_cv(strata = y)
#> # 10-fold cross-validation using stratification
#> # A tibble: 10 × 2
#> splits id
#> <list> <chr>
#> 1 <split [90/10]> Fold01
#> 2 <split [90/10]> Fold02
#> 3 <split [90/10]> Fold03
#> 4 <split [90/10]> Fold04
#> 5 <split [90/10]> Fold05
#> 6 <split [90/10]> Fold06
#> 7 <split [90/10]> Fold07
#> 8 <split [90/10]> Fold08
#> 9 <split [90/10]> Fold09
#> 10 <split [90/10]> Fold10
Created on 2023-07-27 with reprex v2.0.2
This might be a bit misleading, as the sampling here didn't depend on the y value at all. Would it make sense to drop the strata attribute if only one stratum is created?
Finally, would it make sense for the categorical branch of make_strata to provide a message listing the categories that get "pooled" together, and which stratum they were pooled into? This might help users catch processing mistakes, if they weren't expecting to have any rare classes that would get automatically pooled. This might be too noisy though, and not as useful as warning about "single stratum" cases.
- 主要言語
- R
- スター
- 343
- フォーク
- 68
- 平均マージ
- 1時間 9分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tidymodels/rsample のほかの issue
-
tidy-dev-day :nerd_face:
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
tidymodels/rsample#611 ·
-
repeats attribute is hardcoded to 1 for group_vfold_cv()対応中かも @taekop が 17 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
tidymodels/rsample#607 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
tidymodels/rsample#618 ·
-
documentation
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
tidymodels/rsample#608 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
tidymodels/rsample#600 ·
tidymodels/rsample の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
mitchelloharawild/ggtime#39 ·
-
enhancement good first issue help wanted
難易度 2/5 半日 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
GSK-Biostatistics/multigrain#43 ·
メンテナーはふだん 1 日以内に返信