Main functions doesn't do any input checking on `data` argument

Aperta
#474 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
r
Ambito
data

Direzione di ricerca

Start by reproducing the reported cases for the bootstraps and vfold_cv entry points with the invalid data values shown in the issue. Review how these functions currently handle those inputs and add input checking so invalid data produces an appropriate error rather than an empty result or an internal error; add tests for the examples.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

feature

sooo, there isn't much input checking for some of the main functions here in {rsample}, to the point of bootstraps(bootstraps) not returning an error 😬

bootstraps

library(rsample)

mat_cars <- as.matrix(mtcars)

bootstraps(mat_cars, times = 2)
#> # Bootstrap sampling 
#> # A tibble: 2 × 2
#>   splits          id        
#>   <list>          <chr>     
#> 1 <split [32/11]> Bootstrap1
#> 2 <split [32/11]> Bootstrap2

bootstraps(1:10, times = 2)
#> # Bootstrap sampling 
#> # A tibble: 0 × 2
#> # ℹ 2 variables: splits <list>, id <chr>

bootstraps(NULL)
#> # Bootstrap sampling 
#> # A tibble: 0 × 2
#> # ℹ 2 variables: splits <list>, id <chr>

bootstraps(lm(mpg ~ disp, data = mtcars))
#> # Bootstrap sampling 
#> # A tibble: 0 × 2
#> # ℹ 2 variables: splits <list>, id <chr>

vfold_cv

library(rsample)

mat_cars <- as.matrix(mtcars)

vfold_cv(mat_cars)
#> #  10-fold cross-validation 
#> # A tibble: 10 × 2
#>    splits         id    
#>    <list>         <chr> 
#>  1 <split [28/4]> Fold01
#>  2 <split [28/4]> Fold02
#>  3 <split [29/3]> Fold03
#>  4 <split [29/3]> Fold04
#>  5 <split [29/3]> Fold05
#>  6 <split [29/3]> Fold06
#>  7 <split [29/3]> Fold07
#>  8 <split [29/3]> Fold08
#>  9 <split [29/3]> Fold09
#> 10 <split [29/3]> Fold10

vfold_cv(1:10)
#> Error in if (v > max_v) {: argument is of length zero

vfold_cv(NULL)
#> Error in if (v > max_v) {: argument is of length zero

vfold_cv(lm(mpg ~ disp, data = mtcars))
#> Error in if (v > max_v) {: argument is of length zero
Lingua principale
R
Stelle
343
Fork
68
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tidymodels/rsample

Tutte le issue di tidymodels/rsample

Issue simili

Altre issue su R

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.