sk-learn 有没有通过聚合数据集中已有的特征来发现新特征的方法? 我的意思是这样的:foobar=foo/bar
请您参考如下方法:
唯一想到的是PolynomialFeatures :
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]
例子:
>>> X = np.array([[0, 1],
[2, 3],
[4, 5]])
>>> poly = PolynomialFeatures(2)
>>> poly.fit_transform(X)
array([[ 1, 0, 1, 0, 0, 1],
[ 1, 2, 3, 4, 6, 9],
[ 1, 4, 5, 16, 20, 25]])
