How to deal with "Cannot perform the operation norm( {concave}, 2 )" error?

I am working on a regression problem with L1-norm regulation. My objective function is in this form, maximize(-0.5*(Y-D(MW)+)-0.1*sum(abs(W)) ), given D and M, optimize W. And (MW)+ means max(MW, 0).
The dimension of Y is n-by1, D is n-by-m, M is m-by-m, and W is m-by-1;

When I wrote my objective function in this cvx in this form:

cvx_begin quiet
    variable w(mLen, 1)
    variable w0
    maximize( -0.5* norm(Y-fitD*max(fitM*w, 0)- w0)- 0.1*sum(abs(w)) )
subject to
w >= 0;
w0 >= 0
cvx_end

I got the error:Cannot perform the operation norm( {concave}, 2 ).
I would like to ask if there is a way to write this objective so CVX ruleset accepts.

Thank you, and any help would be appreciated!

Error message is because the argument of norm must be affine, which max (of affine) is not. If fitM >= 0 elementwise, you can dispense with max and it should be accepted by CVX. If not, is norm(of its argument) convex (exercise for OP)? Note you can optionally use norm(w,1) instead of sum(abs(w)).

Agreed. I see no reason to have the max in there at all. If fitM is negative, then there’s a trivial reduction in the problem as well.