Description Usage Arguments Details Value Examples
View source: R/helper-partition-data.r
The function randomly partitions a data set into training and test data sets with a specified percentage of observations assigned to the training data set. The user can optionally preserve the proportions of the original data set.
1 2 | partition_data(x, y, split_pct = 2/3,
preserve_proportions = FALSE)
|
x |
a matrix of n observations (rows) and p features (columns) |
y |
a vector of n class labels |
split_pct |
the percentage of observations that will be randomly assigned to the training data set. The remainder of the observations will be assigned to the test data set. |
preserve_proportions |
logical value. If
|
A named list is returned with the training and test data sets.
named list containing the training and test data sets:
train_x
: matrix of the training
observations
train_y
: vector of the training
labels (coerced to factors).
test_x
: matrix
of the test observations
test_y
: vector of
the test labels (coerced to factors).
1 2 3 4 5 6 7 8 9 10 11 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.