DataLoader.Seq: R6 class representign a data loader for sequence datasets.

Description Details Methods Author(s) Examples

Description

R6 class representign a data loader for sequence datasets.

R6 class representign a data loader for sequence datasets.

Details

It loads the data from a R array

Methods

Public methods


Method new()

Initialisation method

Usage
DataLoader.Seq$new(ds, bz)
Arguments
ds

sequence datast

bz

integer, batch size


Method length()

Returns the length of teh data loader object

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

Method has.next()

Returns TRUE if the data loader has still batches available

Usage
DataLoader.Seq$has.next()
Examples
ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
dl = DataLoader.Seq$new(ds, 5)
ds$has.next() # TRUE

Method reset()

Resets the data loader to its initial state

Usage
DataLoader.Seq$reset()

Method feed()

Feeds the data into a sequence of batches of sequences or it creates a new one

Usage
DataLoader.Seq$feed(SEQ, mode = "head")
Arguments
SEQ

batch of sequences. If NULL it creates a new one

mode

feeding mode

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

Method clone()

The objects of this class are cloneable with this method.

Usage
DataLoader.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
## ------------------------------------------------
## Method `DataLoader.Seq$length`
## ------------------------------------------------

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

## ------------------------------------------------
## Method `DataLoader.Seq$has.next`
## ------------------------------------------------

ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1)
dl = DataLoader.Seq$new(ds, 5)
ds$has.next() # TRUE

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

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

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