flow_series_from_dataframe: Setup a time series data generator specification

Description Usage Arguments Details Value Examples

View source: R/flow-series.R

Description

Setup a time series data generator specification

Usage

1
2
3
4
5
flow_series_from_dataframe(data, x, y, length_out, stride, lookback,
  timesteps, batch_size = 32, mode = "training")

## S3 method for class 'series_generator'
tidy_prediction(generator, prediction, ...)

Arguments

data

A tibble or data.frame.

x

A character vectors containing the column names for x variables

y

A character vectors containing the column names for y variables

length_out

An integer specifying length out size.

stride

An integer specifying stride size.

lookback

An integer specifying lookback period.

timesteps

An integer specifying timesteps length.

batch_size

An integer specifying batch size.

mode

A character vector of length one which specify the generator behaviour: either "training" or "prediction". See details for further information.

generator

A reference data generator generated from kerasgenerator package.

prediction

A matrix or an array containing the prediction results

...

Further argument for specific generators. See details.

Details

soon updated

Value

A function which could generate batches of x and/or y arrays

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# import library
library(kerasgenerator)

# create example data
sunspots_df <- as.data.frame(sunspots)

# setup a generator
data_gen <- flow_series_from_dataframe(
  data = sunspots_df,
  x = "x",
  y = "x",
  length_out = 1,
  stride = 1,
  lookback = 1,
  timesteps = 12,
  batch_size = 32,
  mode = "training"
)

# quick check
arrays <- data_gen()

str(arrays[[1]])
str(arrays[[2]])

bagasbgy/kerasgenerator documentation built on Dec. 25, 2019, 8:52 p.m.