JuliaML / MLUtils.jl

Utilities and abstractions for Machine Learning tasks
MIT License
107 stars 20 forks source link

`joinobs` assumes all inputs to be of the same type but returns a different `JoinedData` type #160

Open EssamWisam opened 1 year ago

EssamWisam commented 1 year ago

In particular, the following does not work

data1 = 1:10
data2 = 11:20
data12 = joinobs(data1, data2)
data3 = 21:30
data123 = joinobs(data12, data3)

The error I get is

MethodError: no method matching MLUtils.JoinedData(::Tuple{MLUtils.JoinedData{UnitRange{Int64}, 2}, UnitRange{Int64}}, ::Tuple{Int64, Int64})  

It is nice to have the functionality above because it otherwise may inhibit the use of joinobs in a loop where one iteratively concatenates data into the same variable.

I am not sure how easy this is to generically solve because the implementation lets joinobs make a NTuple{N,T} out of the input data containers and then simulates these being one data container by overriding the base getindex and length methods.