Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

selectrows struggling with views of a table #974

Closed
ablaom opened this issue Apr 24, 2024 · 1 comment
Closed

selectrows struggling with views of a table #974

ablaom opened this issue Apr 24, 2024 · 1 comment
Assignees

Comments

@ablaom
Copy link
Member

ablaom commented Apr 24, 2024

This works fine:

X, y = make_regression()
selectrows(X, 1:70)

But this doesn't:

X, y = make_regression(20)

julia> selectrows(X, 1:70)
ERROR: BoundsError: attempt to access 20-element view(::Matrix{Float64}, :, 1) with eltype Float64 at index [1:70]
Stacktrace:
 [1] throw_boundserror(A::SubArray{Float64, 1, Matrix{…}, Tuple{…}, true}, I::Tuple{UnitRange{…}})                                                                             
   @ Base ./abstractarray.jl:737
 [2] checkbounds
   @ ./abstractarray.jl:702 [inlined]
 [3] _getindex
   @ ./multidimensional.jl:888 [inlined]
 [4] getindex
   @ ./abstractarray.jl:1291 [inlined]
 [5] (::MLJBase.var"#21#22"{UnitRange{Int64}})(c::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{…}, Int64}, true})                           
   @ MLJBase ./none:0
 [6] iterate(::Base.Generator{Tuple{SubArray{…}, SubArray{…}}, MLJBase.var"#21#22"{UnitRange{…}}})                       
   @ Base ./generator.jl:47
 [7] selectrows(::MLJModelInterface.FullInterface, ::Val{:table}, X::Tables.MatrixTable{Matrix{…}}, r::UnitRange{Int64})                                                           
   @ MLJBase ~/MLJ/MLJBase/src/interface/data_utils.jl:95
 [8] selectrows(X::Tables.MatrixTable{Matrix{Float64}}, r::UnitRange{Int64})
   @ MLJModelInterface ~/.julia/packages/MLJModelInterface/ihpHk/src/data_utils.jl:340
 [9] top-level scope
   @ REPL[32]:1
Some type information was truncated. Use `show(err)` to see complete types.
@ablaom
Copy link
Member Author

ablaom commented Apr 24, 2024

Oh silly me.

@ablaom ablaom closed this as completed Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants