Description Usage Arguments Value Author(s) See Also Examples

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

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

`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. |

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). |

Wannes Rosiers

Under the hood this function uses `foreach`

, and `sample`

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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.