createtest {crtests}R Documentation

Create a classification or regression test case

Description

Create a test, which can be run using any of the available runtest functions

Usage

createtest(data, problem = c("classification", "regression"), dependent,
  data_transform = identity, train_index, method, name, description = "",
  ...)

Arguments

data

A data frame

problem

Either classification or regression. This influences how the algorithms are trained and what method is used to determine performance

dependent

The dependent variable: the name of the column containing the prediction goal

data_transform

A quoted function name that transforms the data. It should maintain it in data frame form and maintain the dependent variable.

train_index

A vector of the rows to be used as training set. All other rows will form the holdout set

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

...

Extra arguments used while running the test.

Value

An object of class 'classification' or 'regression', which holds the data, method, etc. for executing the test case.

Examples

data(iris)
# A classification test
test <- createtest(data = iris, 
                  dependent = "Species",
                  problem = "classification",
                  method = "randomForest",
                  name = "An example classification test",
                  train_index = sample(150, 100)
)

# A regression test
test <- createtest(data = iris, 
                  dependent = "Sepal.Width",
                  problem = "regression",
                  method = "randomForest",
                  name = "An example regression test",
                  train_index = sample(150, 100)
)


[Package crtests version 0.2.1 Index]