BaşlayınÜcretsiz Başlayın

Split out the train and test sets

The first step of training a model is dividing the data into train and test sets. The tidymodels package makes this easy. Setting aside a test data set allows you to evaluate the trained model on a set of data the model has never seen.

You will use the employee healthcare attrition data which contains data about employees of a healthcare company and whether they left the company or not. It is available in attrition_df. The target variable is Attrition.

The tidyverse and tidymodels packages have been loaded for you.

Bu egzersiz

Dimensionality Reduction in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Initialize a split of the data with 80% for training and stratify based on Attrition, the target variable.
  • Extract the training data set and store it in train.
  • Extract the testing data set and store it in test.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Initialize the split
split <- ___(___, ___ = ___, strata = ___)

# Extract training set
train <- ___ %>% ___()

# Extract testing set
test <- ___ %>% ___()
Kodu Düzenle ve Çalıştır