Lasso Regression of Matrix of Vectors

Hi all, I’m currently using Convex.jl as one of the packages to solve an optimisation problem. I was wondering if anyone may able to offer any insight into the issue I’m facing.

Currently, I am trying to perform a Lasso regression on a Matrix of vectors for example:
|[a,b] [c,d]|
|[e,f] [g,h]|

I am currently following the example function of LassoEN found in the documentation of the package and it does work perfectly fine for a standard matrix of scalars.
|a b|
|c d|

Upon running on a matrix of vectors I obtain the following error:

Element type mismatch. Tried to create an Adjoint{Adjoint} from an object with eltype Array, but the element type of the adjoint of an object with eltype Array must be Adjoint{_A, _B} where {_A, _B}.
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] checkeltype_adjoint(#unused#::Type{Adjoint}, #unused#::Type{Array})
@ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\adjtrans.jl:76
[3] Adjoint{Adjoint, Vector{Array}}(A::Vector{Array})
@ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\adjtrans.jl:38
[4] Adjoint(A::Vector{Array})
@ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\adjtrans.jl:95
[5] adjoint(A::Vector{Array})
@ LinearAlgebra C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.6\LinearAlgebra\src\adjtrans.jl:136
[6] top-level scope
@ REPL[102]:1

If anyone has any insight into my issue any help would be greatly appreciated, Thank you in advance for your help! Also please let me know if my problem needs a better explanation, I tried my best to show what I meant by a matrix of vectors as opposed to a matrix of scalars. I can elaborate more if needed!

1 Like

I’m probably responsible for the LassoEN() function. It is indeed designed to handle standard vectors/matrices. I suggest that you either convert your data to that format, or extend the existing function.

1 Like

Hi @Alexander_Scott,

What does Lasso regression on a matrix of vectors mean in terms of math? Since this is your first post, take a read of Please read: make it easier to help you. It’s easier to help if you can provide a reproducible example.