train_test_split: Data split

View source: R/deepSelection.r

train_test_splitR Documentation

Data split

Description

Split data into random train and test subsets.

Usage

train_test_split(
  ...,
  test_size = NULL,
  train_size = NULL,
  random_state = NULL,
  shuffle = TRUE
)

Arguments

...

Sequence of data.

test_size

An integer or float value between 0.0 and 1.0 representing the absolute number of test samples (integer) or the proportion of the data to include in the test split (float). If NULL (default), the value is set to the complement of the train size. If train_size is also NULL, it will be set to 0.25.

train_size

An integer or float value between 0.0 and 1.0 representing the absolute number of train samples (integer) or the proportion of the data to include in the train split (float). If NULL (default), the value is set to the complement of the test size.

random_state

Controls the shuffling applied to the data before applying the split. Pass an int for reproducible output across multiple function calls.

shuffle

Whether or not to shuffle the data before splitting.

Value

List containing train-test split of inputs.

Examples

  library(marray)

  df <- data.frame(rating = factor(sample(c("low", "medium", "high") -> lvls, size = 100, replace = T), levels = lvls),
                   personality = sample(30, size = 100, replace = T),
                   motivation = runif(100, min = 0, max = 100))

  a <- marray(1:24, dim = c(4, 3, 2))
  m <- marray(1:24, dim = c(6, 4))
  train_test_split(df, a, m)

  df <- data.frame(y = 1:20, x1 = 1:20, x2 = 1:20)
  X <- marray(df[c("x1", "x2")])
  y <- marray(df[c("y")])
  train_test_split(X, y, random_state = 0, shuffle = T)

stschn/deepANN documentation built on June 25, 2024, 7:27 a.m.