abjer / sds

Social Data Science - a summer school course
https://abjer.github.io/sds
18 stars 34 forks source link

What does PolynomialFeatures do? #15

Closed KarlTjensvoll closed 6 years ago

KarlTjensvoll commented 6 years ago

I have some difficulties to completely understand what this function does.

$y = ax_1 + bx_2 + ...$

If i run this through PolynomialFeatures without sepcifying degrees, it will by default choose 2 degrees. Do we get out this:

$y = ax_1^2 + bx_2^2 ...$

or:

$y = ax_1^2 + bx_2x_1 + ... + ax_1x_2 + bx_2^2 + ...$

?

kristianolesenlarsen commented 6 years ago

They explain it in the first paragraph here: http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.PolynomialFeatures.html