train_valid_test_split: train_valid_test_split Splits feature and target data frames...

Description Usage Arguments Value Examples

View source: R/train_valid_test_split.R

Description

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)

Usage

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

Arguments

x

(data frame) Original features from data set

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

shuffle

(default = TRUE) Shuffle the rows or not

random_state

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

Value

list

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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
train_valid_test_split(x,y)$x_valid
train_valid_test_split(x,y)$x_test
train_valid_test_split(x,y)$y_train
train_valid_test_split(x,y)$y_valid
train_valid_test_split(x,y)$y_test

UBC-MDS/PrepR documentation built on April 2, 2020, 3:55 a.m.