Feed data into a polynomial basis function regression (unregularized) for degree n

machine learningregression

We know that polynomial base function Models is:

$$t = \sum_{i=0}^n w^T\phi_j(x) = w_0*\phi_0(x) + w_1*\phi_1(x) + w_2*\phi_2(x)+ ….$$
$$\phi_j(x) = x^j$$

Problem: I am not sure how to pass the data to the model. For example, degree 2 polynomial base function regression is:
$$t = w_0 + w_1*x + w_2 * x^2 $$

Now I want to feed a table of data into Degree 2 model:

Employee    Target_income    factor_1  factor_2  factor_3  factor_4
A                 100           10        12        9          8
B                 150           19        17        15         10
C                 200           25        15        16         12

To find optimal $w^T$, we find the minimum of square error:
$$E(w) = \frac{1}{2} \sum_{i=0}^n \{ t_i – w^T\phi(x_i) \}^2$$
Okay, I know that $t_i =[100, 150,200]^T$.
What is $w^T\phi(x_i)$ for each employee i here?

To be more precise, when i=1 how can I put the data into this model:
$$t_1 – w^T\phi(x_1) = $$
$$t_1 – (w_0 + w_1*x_1 + w_2 * x_1^2)$$
Employee A salary is defined by 4 factors (data points), but we only have 1 x.

Best Answer

After the discussion in comments, what it seems is that you want tht, for each employee $i$, his/her salary $t_i$ be represented as $$t_i=a+(b_1 f_{1i}+b_2f_{1i}^2)+(c_1 f_{2i}+c_2f_{2i}^2)+(d_1 f_{3i}+d_2f_{3i}^2)+(e_1 f_{4i}+e_2f_{4i}^2)$$ which makes a linear regression for eight variables $(f_{ki},f_{ki}^2)$ for $k=1,2,3,4$ and $i=1,2,\cdots,n$

So,nine parameters. Now, use matrix calculations to get the answer.

Related Question