# Minimalizing mean absolute error through optimisation?

조회 수: 1(최근 30일)
cwj2000 2020년 10월 30일
편집: Jon 2020년 10월 30일
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

댓글을 달려면 로그인하십시오.

### 답변(1개)

Jon 2020년 10월 30일
You should be able to frame this as a linear programming problem which can be solved using MATLAB's linprog function.
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Jon 2020년 10월 30일
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

댓글을 달려면 로그인하십시오.

R2020b

### Community Treasure Hunt

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

Start Hunting!

Translated by