Description Usage Arguments Value Examples
View source: R/train_test_split.R
train_test_split: Split X and ydata into two portions according to input ratio. Default is for the split to include shuffling.
1 | train_test_split(X, y, test_size = 0.25, random_state = 0, shuffle = TRUE)
|
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. |
list of split data in the order X_train, X_test, y_train, y_test.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.