DataSet.Seq: R6 class representign a dataset of sequences to feed RNN

Description Details Super class Methods Author(s) Examples

Description

R6 class representign a dataset of sequences to feed RNN

R6 class representign a dataset of sequences to feed RNN

Details

It load the data from a R array

Super class

modello::DataSet.Array

Methods

Public methods

Inherited methods

Method new()

Initialisation method

Usage
DataSet.Seq$new(X, ls, yi, indexes = NULL)
Arguments
X

matrix/array

ls

integer, sequence length

yi

integer vector, subset of indices to return a targets

indexes

integer vector, a subset of indexes indicating the starting point fir the sequences


Method length()

Returns the length of the dataset

Usage
DataSet.Seq$length()
Examples
ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
ds$length() # 20

Method feed()

Feeds the data into an existing seqience or creating a new one

Usage
DataSet.Seq$feed(x, mode = "head")
Arguments
x

existing sequence, if NULL it creates a new one

mode

chectacter indicating the way to build the sequences

Examples
modello.init(100, 100, 100, 100)
ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
SEQ = ds$feed(NULL)
print(names(SEQ))
print(SEQ$x[[1]]$v)
print(SEQ$y$v)
ds$feed(SEQ)
print(SEQ$x[[1]]$v)
print(SEQ$y$v)
modello.close()

Method rewind()

Sets the data loader back of n previous states. Only available for "head" and "tail" modes.

Usage
DataSet.Seq$rewind(n, mode = "head")
Arguments
n

number of step to rewind

mode

rewind mode. Possibly the same as the feed mode.

Examples
ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
ds$..get.data..("head")
ds$..get.data..("head")
ds$rewind(2)
ds$..get.data..("head")
ds$..get.data..("head")

Method ..pop.index..()

Auxiliary method not to be called directly. It pops an index from the dataset according to the given method

Usage
DataSet.Seq$..pop.index..(mode = "head")
Arguments
mode

popping mode


Method ..feed..()

Auxiliary method. Not to be called directly.

Usage
DataSet.Seq$..feed..(x, mode)
Arguments
x

existing sequence, if NULL it creates a new one

mode

chectacter indicating the way to build the sequences


Method ..get.data..()

Auxiliary method. Not to be called directly.

Usage
DataSet.Seq$..get.data..(mode)
Arguments
mode

chectacter indicating the way to build the sequences


Method clone()

The objects of this class are cloneable with this method.

Usage
DataSet.Seq$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Filippo Monari

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
25
26
27
28
29
30
31
32
## ------------------------------------------------
## Method `DataSet.Seq$length`
## ------------------------------------------------

ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
ds$length() # 20

## ------------------------------------------------
## Method `DataSet.Seq$feed`
## ------------------------------------------------

modello.init(100, 100, 100, 100)
ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
SEQ = ds$feed(NULL)
print(names(SEQ))
print(SEQ$x[[1]]$v)
print(SEQ$y$v)
ds$feed(SEQ)
print(SEQ$x[[1]]$v)
print(SEQ$y$v)
modello.close()

## ------------------------------------------------
## Method `DataSet.Seq$rewind`
## ------------------------------------------------

ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
ds$..get.data..("head")
ds$..get.data..("head")
ds$rewind(2)
ds$..get.data..("head")
ds$..get.data..("head")

modello documentation built on Feb. 2, 2021, 9:06 a.m.

Related to DataSet.Seq in modello...