Minimalizing mean absolute error through optimisation?

11 views (last 30 days)
Hi all,
I have 3 vectors (a,b and c), with 17 numeric elements in each.I am comparing these to another vector, d, (also 17 numeric elements) which is used as the gold-standard reference point.
Individually I can find how well each of the three vectors compare with d using mae:
meanAbsoluteErrorA = mae(d-a);
meanAbsoluteErrorB = mae(d-b);
meanAbsoluteErrorC = mae(d-c);
I was then wondering if I could combine and weight the three vectors a,b and c to reduce the error. e.g: if you took each to have an equal weighting:
meanAbsoluteErrorCombined = mae((1/3 * a) + (1/3 * b) + (1/3 * c) - d)
How could i optimise the choosing of the weights to get the smallest mae. I can't seem to work this using the optimisation tool. Is it possible to optimise an mae like this as I seem to be producing error after error and also can't seem to find a similar example online.
Effectively, I have the following optimisation problem:
Minimise f(alpha1,alpha2) = mae((alpha1*a) +(alpha2*b)+(alpha3*c) - d)
with alpha1+alpha2 + alpha3 = 1
and alpha1,alpha2,alpha3>=0
OR ALTERNATIVELY
Minimise f(alpha1,alpha2) = mae((alpha1*a) +(alpha2*b)+((1-alpha1-alpha2)*c) - d)
with alpha1, alpha2, alpha3>=0
Thanks in advance!

Answers (1)

Jon
Jon on 30 Oct 2020
You should be able to frame this as a linear programming problem which can be solved using MATLAB's linprog function.
  2 Comments
Jon
Jon on 30 Oct 2020
Edited: Jon on 30 Oct 2020
This may not be obvious at first, but if you Google norm minimization using linear programming and look for l1 norm minimization you will see many examples. Note mean absolute error is essentially the l1 norm. See for example https://www.princeton.edu/~chiangm/ele539l3a.pdf page 6
Jon
Jon on 30 Oct 2020
You should also be able to do it using MATLAB's fmincon however if you can get it solved using the linear programming approach it should be more efficient and avoid possible numerical issues of using a more general solver

Sign in to comment.

Categories

Find more on Mathematics in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!