Learn R Programming

randomUniformForest (version 1.0.6)

init_values: Training and validation samples from data

Description

Draw training and test samples from data. Samples can be accessed by subsctioting original data or by their own references.

Usage

init_values(X, Y = NULL, sample.size = 0.5, 
data.splitting = "ALL", 
unit.scaling = FALSE, 
scaling = FALSE, 
regression = FALSE)

Arguments

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.

Value

  • a list with the following components :
  • xtraina matrix or data frame representing the training sample.
  • ytraina response vector representing the training responses according to the training sample.
  • xtesta matrix or data frame representing the validation sample.
  • ytesta response vector representing the validation responses according to the validation sample.
  • train_idxsubscripts of the training sample.
  • test_idxsubscripts of the validation sample.

Examples

Run this code
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

Run the code above in your browser using DataLab