trainSample: Sample data in parallel

Description Usage Arguments Value Author(s) See Also Examples

Description

Sample data or data and output in parallel: each core provides one sample of your desired size.

Usage

1
trainSample(x, y = NULL, numberCores = detectCores(), samplingSize = 0.2)

Arguments

x

A data frame, or structure convertable to a data frame, which you want to sample upon.

y

An vector containing a target variable for predictions later on. This target variable could be contained in x as well, then y is set to NULL.

numberCores

In this setting equal to number of different training samples you are creating: one for each core you are using.

samplingSize

Size of your training sample in percentage.

Value

If y is null, you get a list of length numberCores. Each core has created one item of your list, namely a data frame containing a a samplingSize size sample of x. If y is not null, again you get a list of length numberCores. Each core has created one item of your list, namely:

xSample

A data frame containing a samplingSize size sample of x.

ySample

A vector with the corresponding y values (corresponding indices with x).

Author(s)

Wannes Rosiers

See Also

Under the hood this function uses foreach, and sample

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# Create your data
x <- data.frame(1:10,10:1)
y <- 1:10

# Sampling with provided y
trainSample(x,y,numberCores=2,samplingSize = 0.5)

# Sampling without provided y
trainSample(x,numberCores=2,samplingSize = 0.5)

## End(Not run)

parallelSVM documentation built on May 2, 2019, 9:32 a.m.