getobs

function defined in module MLUtils


			getobs(data, [idx])

Return the observations corresponding to the observation-index idx. Note that idx can be any type as long as data has defined getobs for that type.

If data does not have getobs defined, then this function falls back to data[idx]. Authors of custom data containers should implement Base.getindex for their type instead of getobs. getobs should only be implemented for types where there is a difference between getobs and Base.getindex (such as multi-dimensional arrays).

The returned observation(s) should be in the form intended to be passed as-is to some learning algorithm. There is no strict interface requirement on how this "actual data" must look like. Every author behind some custom data container can make this decision themselves. The output should be consistent when idx is a scalar vs vector.

See also getobs! and numobs