Reference for implementing the data container interface . See data containers for an introduction .
To implement the data container interface for a custom type
T
, you must implement two functions:
LearnBase.getobs(data::T, i::Int)
loads the
i
-
th observation
LearnBase.nobs(data::T, i::Int)::Int
gives the number of observations in a data container
You can optionally also implement:
LearnBase.getobs!(buf, data::T, i::Int)
: loads the
i
-
th observation into the preallocated buffer
buf
.
See the MLDataPattern . jl documentation for a comprehensive discussion of and reference for data containers .
To define a method for the above functions, you need to import the functions explicitly
.
You can do this without installing
LearnBase
by running:
import
DataLoaders
.
LearnBase
:
getobs
,
nobs
,
getobs!
The following pages link back here: