Skip to content

Output data of slidingwindow does not support getobs(data, idx) when idx is a vector of integers #213

@ablaom

Description

@ablaom
x = [1 2 3 4 5;
     6 7 8 9 10]
data = MLUtils.slidingwindow(x, size=2)

# works as adverised:
MLUtils.getobs(data, 1)
# 2×2 Matrix{Int64}:
#  1  2
#  6  7

MLUtils.getobs(data, 1:2)
# ERROR: MethodError: no method matching getindex(::MLUtils.SlidingWindow{Matrix{Int64}}, ::UnitRange{Int64})
# The function `getindex` exists, but no method is defined for this combination of argument types.

The code only implements a single integer, as far as I could tell.

The doc-string suggests the above ought to have worked: "When indexing the data is accessed as getobs(data, idxs), with idxs an appropriate range of indexes."

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions