Printing with resampling weights

オープン
#593 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
r

調査の方向性

Start by locating the S3 print methods for rset and manual_rset and inspect how subclasses such as v_fold dispatch printing. Check the proposed weighted-output behavior against the existing default printing path, then verify that weighted rsets show fold_weight while unweighted objects retain their current output.

索引モデルが issue の本文から書いたものです。

説明

feature

With printing in the rset objects, I think that we'll have to move this code into an rsample PR.

Most of the rsets have a superseding class (like v_fold) and the print method for that class happens first.

Using v_fold as an example, its print method removes the first two classes (v_fold and rset) so that the remaining printing is the default tibble printing. That's why there is not a rsample:::print.rset method.

I'm going to temporarily remove the print methods and make this comment an issue for rsample, and then Hannah can take a look (who is out of office next week 😿)


#' @export
print.rset <- function(x, ...) {
  fold_weights <- attr(x, ".fold_weights")

  if (!is.null(fold_weights)) {
    # Create a tibble with fold weights as a column
    x_tbl <- tibble::as_tibble(x)
    x_tbl$fold_weight <- fold_weights
    print(x_tbl, ...)
  } else {
    # Use default behavior
    NextMethod("print")
  }
}

#' @export
print.manual_rset <- function(x, ...) {
  fold_weights <- attr(x, ".fold_weights")

  if (!is.null(fold_weights)) {
    # Create a tibble with fold weights as a column
    x_tbl <- tibble::as_tibble(x)
    x_tbl$fold_weight <- fold_weights
    print(x_tbl, ...)
  } else {
    # Use default behavior for manual_rset
    NextMethod("print")
  }
}

Originally posted by @topepo in https://github.com/tidymodels/tune/issues/1007#issuecomment-3417377573

主要言語
R
スター
343
フォーク
68
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tidymodels/rsample のほかの issue

tidymodels/rsample の issue をすべて見る

似ている issue

R の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。