Polynomial regression for 2D data (paraboloid fitting)

727 Views Asked by At

I want to create cool 2D parabolic fits like these figures

enter image description here

However, I do not know how to mathematically formulate the problem.

I know how to formulate the 1D polynomial fitting problem,

which is to solve $\frac{1}{2}\|Xw - b\|^2_2$, where $w$ are the weights of a polynomial, and $$X = \begin{pmatrix} 1 & x_1 & x_1^2 & \dots & x_1^n \\ 1 & x_2 & x_2^2 & \dots & x_2^n \\ \vdots & \vdots & \vdots & \cdots & \vdots\\ 1 & x_m & x_m^2 & \cdots & x_m^n \end{pmatrix}$$

$b$ is the target values associated with each $x_1$, each $x_1, x_2, \ldots, x_m$ being a 1D data.

But what if $x_1, x_2, \ldots, x_m$ are 2D. For example, $x_1$ is height and weight. Then I could not form the matrix $X$!

How do I formulate 2D polynomial fitting mathematically? Any reference will help.

1

There are 1 best solutions below

0
On BEST ANSWER

$\frac{1}{2}\|Xw_h+Yw_w - b\|^2_2$

Where $w_h$ denotes heights and $w_w$ denotes weights

This will create a plane

If you want to create more accurate like a 3D parabola then go for higher powers like square or cubes. But remember as the power goes higher the chances of overfitting goes high