View source: R/genericFunctions.R
init_values | R Documentation |
Draw training and test samples from data. Samples can be accessed by subsctioting original data or by their own references.
init_values(X, Y = NULL, sample.size = 0.5, data.splitting = "ALL", unit.scaling = FALSE, scaling = FALSE, regression = FALSE)
X |
a matrix or dataframe to be splitted in training and validation sample |
Y |
a response vector for the observed data. |
sample.size |
size of the needed training sample in proportion of the nulber of observations in original data. |
data.splitting |
not currently used. |
unit.scaling |
if TRUE, scale all data in X between 0 and 1, if they are all positive, or between -1 and 1. |
scaling |
if TRUE, centers and scales data, so each variable willhave mean 0 abd variance 1. |
regression |
if TRUE and scaling = TRUE, Y will also be scaled. |
a list with the following components :
xtrain |
a matrix or data frame representing the training sample. |
ytrain |
a response vector representing the training responses according to the training sample. |
xtest |
a matrix or data frame representing the validation sample. |
ytest |
a response vector representing the validation responses according to the validation sample. |
train_idx |
subscripts of the training sample. |
test_idx |
subscripts of the validation sample. |
Saip Ciss saip.ciss@wanadoo.fr
data(iris) Y <- iris$Species X <- iris[,-which(colnames(iris) == "Species")] trainingAndValidationsamples <- init_values(X, Y, sample.size = 0.5) Xtrain = trainingAndValidationsamples$xtrain Ytrain = trainingAndValidationsamples$ytrain Xvalid = trainingAndValidationsamples$xtest Yvalid = trainingAndValidationsamples$ytest
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.