parse_mungepiece: Translate a list of arguments passed to a mungebit into a...

Description Usage Arguments Value Examples

Description

For example, one can pass a training function, a prediction function, and additional arguments, and the constructed mungepiece will hold these arguments, ready to call the attached mungebit on a given dataframe.

Usage

1
parse_mungepiece(args, train_only = FALSE)

Arguments

args

a list. This can be of the formats list(train_fn, ...), list(list(train_fn, predict_fn), ...), and list(list(train_fn, ...), list(predict_fn, ...)). In the first example, the train and predict function are assumed to be identical. In the first two examples, the arguments to these functions are assumed to be identical (for example, if the same kind of filter needs to be applied to a data set that is about to be trained as to one about to be predicted). Finally, the last example is the most flexible and allows different parameters for the training and prediction function, respectively. The given training and prediction functions are used to construct a mungebit, and the resulting mungebit and the remaining arguments are stored in a mungepiece.

train_only

logical. Whether or not to leave the trained parameter on each mungebit to TRUE or FALSE accordingly. For example, if stagerunner = TRUE and we are planning to re-use the stagerunner for prediction, it makes sense to leave the mungebits untrained. (Note that this will prevent one from being able to run the predict functions!)

Value

the parsed mungepiece

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
doubler <- column_transformation(function(x) x * 2)
mp <- parse_mungepiece(list(doubler, 'Sepal.Length'))
iris2 <- mungeplane(iris)
mp$run(iris2)
stopifnot(all.equal(iris2$data[[1]], 2 * iris[[1]]))

# TODO: Way more examples, unit tests


## End(Not run)

robertzk/mungebits documentation built on May 27, 2019, 10:35 a.m.