Description Usage Arguments Value Examples
Wrapper for creating multiple copies of a test and running them. This function supports cross validation and regular sampling. Cross validation splits the data into 'iterations' number of folds, and uses one fold as holdout, using every other fold as training set. This is repeated 'iteration's times, using every fold as holdout exactly once. Non-cross validation takes a random sample of size holdout * nrow(data) and uses it as holdout, the rest is used for training. This is repeated 'iteration's times. Test creation and execution is handled by create_and_run_test
1 2 3 4 |
data |
A data frame |
dependent |
The dependent variable: the name of the column containing the prediction goal |
problem |
Either classification or regression. This influences how the algorithms are trained and what method is used to determine performance |
method |
The regression or classification method |
name |
The name of the test. Printed in the test results |
description |
Optional. A more elaborate description of the test |
data_transform |
A quoted function name that transforms the data. It should maintain it in data frame form and maintain the dependent variable. |
iterations |
The number of times the test is to be performed. If cross-validation is used, this is the number of folds |
holdout |
Sample testing only. The fraction of data to be used as holdout set |
cross_validation |
Logical. Should cross validation be used? |
preserve_distribution |
Logical, classification problems only. Should the distribution of factors in the dependent variable be as similar as possible between holdout and training sets? |
A list of class 'multitest_results_' + problem
, containing the test results of each iteration
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## Not run:
library(crtests)
library(randomForest)
library(rpart)
library(caret)
library(stringr)
# A classification multitest
multitest(data = iris,
dependent = "Species",
problem = "classification",
method = "randomForest",
name = "An example classification multitest",
iterations = 10,
cross_validation = TRUE,
preserve_distribution = TRUE
)
# A regression multitest
multitest(data = iris,
dependent = "Sepal.Width",
problem = "regression",
method = "rpart",
name = "An example regression multitest",
iterations = 15,
cross_validation = FALSE,
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.