mlts_transform: Transform a time series to a machine learning-friendly format

Description Usage Arguments Value Examples

View source: R/transform.R

Description

Performs the necessary transformations to make a univariate time series acceptable for use with machine learning models like neural networks.

Usage

1
2
3
mlts_transform(.data, .dt, .y, p = 1, xreg = NULL,
  granularity = NULL, extras = FALSE, extrasAsFactors = FALSE,
  start = c("Mon", "Sun"))

Arguments

.data

A tidy data.frame/tbl

.dt

Name of the column in .data containing the date-times; does not need to be a character

.y

Name of the column in .data containing an evenly spaced time series as a numeric vector or factor; does not need to be a character

p

Number of previous observations to turn into features (think AR(p))

xreg

A character vector of column names of external regressors in .data

granularity

One of: second, minute, hour, day, week, month, quarter, year. If not specified, will attempt to detect.

extras

Whether maltese will create new features (like day of week)

extrasAsFactors

Whether to output extra features as factors or numeric (default). If TRUE, some (like day of week or month) will be ordered factors.

start

Which day does the week start? "Sun"day or "Mon"day (default)?

Value

A data.frame suitable for supervised learners with columns:

dt

The date or date-time (same as dt)

y

The time series

mlts_lag_k

The previous k-th observation

mlts_extras_?

Extra features like hour of day, day of the week, month of the year, etc.

Examples

1
2
data("r_enwiki", package = "maltese")
mlts <- mlts_transform(head(r_enwiki), date, pageviews)

bearloga/maltese documentation built on March 7, 2020, 11:03 a.m.