MLDataPattern.jl
MLDataPattern.jl copied to clipboard
Support of NamedTuples
trafficstars
This should be supported.
dataset = (x=rand(10), y=rand(2, 10))
for batch in eachbatch(dataset; size=3)
# do something with batch.x and batch.y
end
This is a significant part of https://github.com/JuliaML/MLDataUtils.jl/issues/46
Since a named tuple of vectos is a valid Tables.jl ColumnTable
So solving this would make big steps towards Tables.jl compat.
As a short term workaround if you load MLDataUtils, DataFrames support will be loaded, and then you can do:
dataset = (x=rand(10), y=rand(2, 10))
df = DataFrame(dataset)
for batch in eachbatch(df; size=3)
# do something with batch.x and batch.y
end