Differentiate between initial split and splits in resamples in the accessor functions `training()`/ `testing()` / `analysis()`/`assessment()`

Open
#394 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
r
Domain
data

Research direction

Start with the training(), testing(), analysis(), and assessment() accessors, then inspect how initial_split() and vfold_cv() represent their rsplit objects. Confirm the existing accessor behavior and tests before changing it; done means initial splits reject analysis()/assessment(), while resample splits reject training()/testing().

Written by the indexing model from the issue text.

Description

feature

TMwR calls the elements of the initial split "training" and "testing" set and the elements of the a resample "analysis" and "assessment" set.

In rsample, both of those types of splits are rsplit objects and all of training()/ testing() / analysis()/assessment() work on all rsplit objects. We should be more consistent with that conceptual difference and make training()/ testing() work only on initial splits and analysis()/assessment() only on splits in resamples.

library(rsample)

split_init <- initial_split(mtcars)
cars_train <- training(split_init)
cars_analysis <- analysis(split_init) # this should error

folds <- vfold_cv(mtcars, v = 3)
fold_1 <- folds$splits[[1]]
analysis_1 <- analysis(fold_1)
train_1 <- training(fold_1) # this should error

Created on 2022-12-06 with reprex v2.0.2

Dominant language
R
Stars
343
Forks
67
Avg merge
1h 9m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tidymodels/rsample

All issues in tidymodels/rsample

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.