train_test_split: train_test_split: Split X and ydata into two portions...

Description Usage Arguments Value Examples

View source: R/train_test_split.R

Description

train_test_split: Split X and ydata into two portions according to input ratio. Default is for the split to include shuffling.

Usage

1
train_test_split(X, y, test_size = 0.25, random_state = 0, shuffle = TRUE)

Arguments

X

features, a dataframe or a vector,

y

target, a vector or a dataframe.

test_size

float between 0 and 1

random_state

A integer for setting the random seed.

shuffle

boolean, when TRUE, shuffle the data.

Value

list of split data in the order X_train, X_test, y_train, y_test.

Examples

1
2
3
X = data.frame(X = rnorm(100, 0, 10))
y =data.frame(y = 2 * X$X + rnorm(100))
split_data = train_test_split(X, y, test_size = 0.5)

UBC-MDS/CrossR documentation built on May 25, 2019, 1:35 p.m.