DataSet.Array: R6 class representing an array dataset

Description Details Methods Author(s) Examples

Description

R6 class representing an array dataset

R6 class representing an array dataset

Details

It loads the data from an R array

Methods

Public methods


Method new()

Initialisation method.

Usage
DataSet.Array$new(X, indexes, yi, si)
Arguments
X

array

indexes

subset of indexes along the sliceing dimension

yi

subset of indexes to return as targets

si

index of slicing dimension


Method length()

Returns the length of the dataset

Usage
DataSet.Array$length()
Examples
X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
ds$length() # 20

Method has.next()

Returns TRUE if the dataset has still data

Usage
DataSet.Array$has.next()
Examples
X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
ds$has.next() # TRUE

Method reset()

Reset the dataset to its initial state

Usage
DataSet.Array$reset()
Examples
X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
ds$..get.data..()
ds$..get.data..()
ds$reset()
ds$..get.data..()

Method ..pop.index..()

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

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

popping mode


Method ..get.data..()

Auxiliary method not to be called directly.

Usage
DataSet.Array$..get.data..(mode = "head")
Arguments
mode

popping mode


Method feed()

Method to feed the bathces of data to 'numbers'.

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

number

mode

popping mode

Examples
modello.init(100, 100, 100, 100)
X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
x = number(rnorm(5))
print(x$v)
ds$feed(x)
print(x$v)
modello.close()

Method clone()

The objects of this class are cloneable with this method.

Usage
DataSet.Array$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
33
34
35
36
37
38
39
## ------------------------------------------------
## Method `DataSet.Array$length`
## ------------------------------------------------

X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
ds$length() # 20

## ------------------------------------------------
## Method `DataSet.Array$has.next`
## ------------------------------------------------

X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
ds$has.next() # TRUE

## ------------------------------------------------
## Method `DataSet.Array$reset`
## ------------------------------------------------

X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
ds$..get.data..()
ds$..get.data..()
ds$reset()
ds$..get.data..()

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

modello.init(100, 100, 100, 100)
X = matrix(rnorm(100), 20)
ds = DataSet.Array$new(X, 1:20, 1, 1)
x = number(rnorm(5))
print(x$v)
ds$feed(x)
print(x$v)
modello.close()

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