scitkit polyenmialfeatures-努力了解更高程度的结果

发布于 2025-01-23 14:54:42 字数 506 浏览 0 评论 0 原文

如下所示,我能够掌握第二度转换的多发性概念:

但是,如果我的输入向量为 [a,b,c] ,我需要进行第四级转换。 如果我保持交互作用( Interactions_only = false ),我的转换向量将如何看起来像。

是否是这样的:

[a,b,c, a^2, b^2,c^2,a^3, b^3,c^3, a^4, b^4,c^4, ab, bc, ca, a^2b^2,b^2c^2,c^2a^2,a^3b^3,b^3c^3,c^3a^3] 

或不同的程度也相互作用,例如 a^3b^2

I am able to grasp the PolyFeature concept for 2nd degree transformation, as cleared here: Cannot understand with sklearn's PolynomialFeatures

But what if my input vector is [a,b,c] and I need to do a 4th degree transformation.
How would my transformed vector then look like, if I keep interactions (interactions_only = False).

Would it be this:

[a,b,c, a^2, b^2,c^2,a^3, b^3,c^3, a^4, b^4,c^4, ab, bc, ca, a^2b^2,b^2c^2,c^2a^2,a^3b^3,b^3c^3,c^3a^3] 

or do the different degrees also interact, e.g. a^3b^2?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦境 2025-01-30 14:54:42

使用 Interactions_only = false ,它将给出所有组合的学位较小或等于您提供的学位。记住,给定组合的程度是组合中每个单个变量的度的总和(例如,A³ *b²具有5度,A *B³具有4度等)。

例如,对于3度,它将给出:

[1,A,B,C,A²,B²,C²,A³,B³,C³,AB,AC,BC,BC,A²B,A²C,A²C,B²A,B²C,C²A,C²B,C²B,C²B,C²b, ABC]

使用 Interactions_only = true ,它将给出所有组合的学位较小或等于您在该组合中所提供的度数较小或等级的学位。

例如,对于度量3,它将给出:

[1,A,B,C,AB,AC,BC,ABC]

来源: Scikit学习用户指南

With interactions_only=False , it will give all the combinations having a degree less or equal the degree you provide. Remembering that the degree of a given combination is the sum of the degrees of each individual variable in the combination (for example, a³ * b² has degree 5, a * b³ has degree 4 etc).

For example, for degree 3, it will give:

[1, a, b, c, a², b², c², a³, b³, c³, ab, ac, bc, a²b, a²c, b²a, b²c, c²a, c²b, abc]

With interactions_only=True , it will give all the combinations having degree less or equal the degree you provide with each individual term in the combination having degree less or equal 1.

For example, for degree 3, it will give:

[1, a, b, c, ab, ac, bc, abc]

Source: the scikit learn user guide

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文