[scikit-learn] PolynomialFeatures

Sole Galli solegalli1 at gmail.com
Fri Nov 22 11:47:53 EST 2019


Hello team,

Can I double check with you that I understand correctly what the
PolynomialFeatures() is doing under the hood?

If I set it like this:

poly = PolynomialFeatures(degree=3, interaction_only=False,
include_bias=False)

and I fit it on a dataset with 3 variables, a,b and c.

Am I correct to say that the fit() method creates all possible combinations
like this:
a;
b;
c;
(a+b)^2
(a+b)^3
(a+c)^2
(a+c)^3
(c+b)^2
(c+b)^3
(a+b+c)^2
(a+b+c)^3

And the transform() generates the expansion, without the constant that
multiplies the interactions and avoiding duplicated terms after the
expansion?

Thanks for the help.

Kind regards

Sole
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20191122/76550f45/attachment.html>


More information about the scikit-learn mailing list