Take timon's method and represent the inputs as a matrix I (of the values of A, B, C, D, and any combinations thereof using the multiplication or division operators- so A, B, C, D, AB, AC, AD, BC, BD, CD, A/B, A/C, A/D, B/A, B/C, B/D, C/A, C/B, C/D, D/A, D/B, D/C- just have to keep them linearly independent; also add a column of all 1's just so you can find the constant); similarly, represent the outputs as a column-vector X where the value at each row is the value of X. Feel free to leave out input combinations that you know are unnecessary.
Then use the matrix formula for linear regression- (I' * I)^-1 * I' * X
(source:
https://onlinecourses.science.psu.edu/stat501/node/382)
You should get a column-vector K where the values at each row correspond to the coefficient for the same-numbered column in I.
The following weights:
2.5000e+02
5.0000e-01
-2.0982e+01
4.5519e-15
-3.5000e+00
-2.4040e+02
5.0071e-14
5.0000e-01
-1.1744e-15
-8.7397e-13
work for all but the last 6 examples; they're off (underestimating) by -4.76552 for the last 4-6 and -19.06209 for the last 1-3.
Here's an equation that works near-perfectly (off by 3.6 * 10 ** -15 for 4 of the last 6 examples):
X = 250 * A + 0.5 * B - 45.2 * C + -3.5 * A*B - 24 * A*C + 0.5 * B*C
My current best guess:
X = 70 - 100*A -0.2*B + 0.5*B*C + 250*A*C
I'd refine this comment and figure out what I did wrong above (other than forgetting the constant term) but it's 5:28 AM
But I think using the matrix formula above is a good place to start
or you could treat this as a system of equations and solve it that way using matrices
Edited 1/15/2018 10:55:12