Learn R Programming

modello (version 0.1.1)

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

Description

R6 class representign a data loader for sequence datasets.

R6 class representign a data loader for sequence datasets.

Arguments

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.

Details

It loads the data from a R array

Examples

Run this code
# NOT RUN {
## ------------------------------------------------
## 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()
# }

Run the code above in your browser using DataLab