Learn R Programming

modello (version 0.1.1)

DataSet.Array: R6 class representing an array dataset

Description

R6 class representing an array dataset

R6 class representing an array dataset

Arguments

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.

Details

It loads the data from an R array

Examples

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

Run the code above in your browser using DataLab