split_data | R Documentation |
This function splits the input data and response variables into training and testing parts.
split_data(X, y, p.train = 0.7, n.train = round(nrow(X) * p.train))
X |
Input matrix, of dimension |
y |
Vector of response variables. |
p.train |
Percentage of training set. |
n.train |
Number of cases for training; will override |
List of training data x.tr
, y.tr
and testing data x.te
, y.te
.
dat <- gendata_MLR(n = 100, p = 10)
dat <- split_data(dat$X, dat$y, p.train = 0.7)
dim(dat$x.tr)
dim(dat$x.te)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.