train_valid_test_split Splits feature and target data frames into random train, validation and test subsets The proportion of the train set relative to the input data will be valid_size * (1 - test_size)

train_valid_test_split(
  x,
  y,
  test_size = 0.25,
  valid_size = 0.25,
  shuffle = TRUE,
  random_state = NULL
)

Arguments

x,

y arrays

y

(data frame) Original labels from data set

test_size

(double, default = NULL) Value between 0.0 and 1.0 to represent the proportion of the dataset to comprise the size of the test subset

valid_size

float or None (default = 0.25) Value between 0.0 and 1.0 to represent the proportion of the dataset to comprise the size of the test subset

random_state

(int, default = NULL) Seed for the random number generator

x

(data frame) Original features from data set

Value

Examples

x = data.frame('X1'=c(0,1,2,3,4,5,6,7), 'X2'=c(8,9,10,11,12,13,14,15)) y = data.frame('Y'=c(0,1,2,3,4,5,6,7)) train_valid_test_split(x,y)$x_train
#> X1 X2 #> 8 7 15 #> 5 4 12 #> 2 1 9 #> 3 2 10
train_valid_test_split(x,y)$x_valid
#> X1 X2 #> 7 6 14 #> 2 1 9
train_valid_test_split(x,y)$x_test
#> X1 X2 #> 5 4 12 #> 8 7 15
train_valid_test_split(x,y)$y_train
#> y_train #> 1 6 #> 2 1 #> 3 0 #> 4 7
train_valid_test_split(x,y)$y_valid
#> y_valid #> 1 6 #> 2 0
train_valid_test_split(x,y)$y_test
#> y_test #> 1 6 #> 2 4