How to find least-mean-square error quadratic upper bound?
<p>I have some data of the form</p>

<p><code>x1[i], x2[i], x3[i], z[i]</code>,</p>

<p>where <code>z[i]</code> is an unknown deterministic function of <code>x1[i], x2[i], and x3[i]</code>.  I would like to find a quadratic function <code>u(x1, x2, x3)= a11*x1^2 + a22*x2^2 + a33*x3^2 + a12*x1*x2 + ... + a0</code> that overbounds the data, i.e., <code>u(x1[i], x2[i], x3[i]) &gt;= z[i]</code> for all <code>i</code>, and that minimizes the sum of the squared errors subject to the constraints.  </p>

<p>Is there a computationally efficient solution approach in either Python or Matlab?</p>

<p>Your problem sounds like a <a href="https://en.wikipedia.org/wiki/Quadratic_programming" rel="nofollow">quadratic programming problem</a> with linear constraints. There are efficient algorithms to solve these and they are implemented in Matlab and Python as well; see <a href="https://www.mathworks.com/help/optim/ug/quadprog.html" rel="nofollow"><code>quadprog</code></a> and <a href="https://courses.csail.mit.edu/6.867/wiki/images/a/a7/Qp-cvxopt.pdf" rel="nofollow">CVXOPT</a> respectively.</p>

python matlab least-squares