Description Details Super class Methods Author(s) Examples
R6 class representign a dataset of sequences to feed RNN
R6 class representign a dataset of sequences to feed RNN
It load the data from a R array
modello::DataSet.Array
new()
Initialisation method
DataSet.Seq$new(X, ls, yi, indexes = NULL)
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
length()
Returns the length of the dataset
DataSet.Seq$length()
ds = DataSet.Seq$new(matrix(rnorm(100), 20), 5, 1) ds$length() # 20
feed()
Feeds the data into an existing seqience or creating a new one
DataSet.Seq$feed(x, mode = "head")
x
existing sequence, if NULL it creates a new one
mode
chectacter indicating the way to build the sequences
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()
rewind()
Sets the data loader back of n previous states. Only available for "head" and "tail" modes.
DataSet.Seq$rewind(n, mode = "head")
n
number of step to rewind
mode
rewind mode. Possibly the same as the feed mode.
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")
..pop.index..()
Auxiliary method not to be called directly. It pops an index from the dataset according to the given method
DataSet.Seq$..pop.index..(mode = "head")
mode
popping mode
..feed..()
Auxiliary method. Not to be called directly.
DataSet.Seq$..feed..(x, mode)
x
existing sequence, if NULL it creates a new one
mode
chectacter indicating the way to build the sequences
..get.data..()
Auxiliary method. Not to be called directly.
DataSet.Seq$..get.data..(mode)
mode
chectacter indicating the way to build the sequences
clone()
The objects of this class are cloneable with this method.
DataSet.Seq$clone(deep = FALSE)
deep
Whether to make a deep clone.
Filippo Monari
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.