sklearn preprocessing PolynomialFeatures 用法

               
1、sklearn.preprocessing.PolynomialFeatures类
先给出它的官方文档链接http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.PolynomialFeatures.html。
首先要知道它是一个类。全称如下:class sklearn.preprocessing.PolynomialFeatures(degree=2, interaction_only=False, include_bias=True)
官文的注释如下:
Generate polynomial and interaction features.
Generate a new feature matrix consisting of all polynomial combinations of the features with degree less than or equal to the specified degree. For example, if an input sample is two dimensional and of the form [a, b], the degree-2 polynomial features are [1, a, b, a^2, ab, b^2].


我的理解是:专门产生多项式的,并且多项式包含的是相互影响的特征集。比如:一个输入样本是2维的。形式如[a,b] ,则二阶多项式的特征集如下[1,a,b,a^2,ab,b^2]。


参数理解:(一共只有3个参数)
degree : integer
The degree of the polynomial features. Default = 2.
多项式的阶数,一般默认是2。


interaction_only : boolean, default = False
If true, only interaction features are produced: features that are products of at most degree distinct input features (so not x[1] ** 2, x[0] * x[2] ** 3, etc.).
如果值为true(默认是false),则会产生相互影响的特征集。


include_bias : boolean
If True (default), then include a bias column, the feature in which all polynomial powers are zero (i.e. a column of ones - acts as an intercept term in a linear model).
是否包含偏差列


属性:
powers_ : arr
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值