Description Usage Arguments Value See Also Examples
This function creates time-based minimum, maximum, mean, sum, and standard deviation of numeric columns of a data frame. These values are calculated based on specific time steps provided by the user.
1 | TimeWindow(input, parallel, cores, target, no.use, steps)
|
input |
an object of type data.frame. Preferably the output of reshapeData(). |
parallel |
an optional logical value True or False. Parameter specifies if parallel computation is enabled according to the foreach package. Can result in tremendous improvement of computation time. Default is False. |
cores |
an optional non-negative integer. The desired number of cores utilized if parallel = T. Default is the number of cores available -1. |
target |
a mandatory character string defining the dependent variable which is therefore not included in the computation. |
no.use |
an optional character string that defines other variables that should not be used. |
steps |
an optional non-negative numeric value defining the time window. Steps defines how many previous points in time are considered (including current point in time). Default is 2. |
An object of type data.frame in the same form as data including additional features.
foreach
, registerDoSNOW
, makeCluster
, detectCores
1 2 3 4 5 6 7 8 9 10 11 | # create data frame with mandatory columns
data = data.frame('id'=rep(c(1:5), each=8),
'type'=rep(c('Var1', 'Var2'), times=20),
'value'=rep(c(1:5), times=8),
'date'=rep(seq(as.Date("2000/1/1"), by = "day", length.out=20), each=2))
# create rectangle version of user journey
dat = reshapeData(data)
# use function to create new features based on time windows
dat_feat = TimeWindow(dat, parallel=T, cores=2, target='Var1', no.use=F, steps=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.