If I have a moderate amount of basic functions and I get a moderate order of polynomial functions from them, there may be confusion to know which column of the attribute array preprocess_XXcorresponds to the transformation of the basic functions.
I used something like the following, with the old version of sklearn (maybe 0.14?):
import numpy as np
from sympy import Symbol
from sklearn.preprocessing import PolynomialFeatures
poly = PolynomialFeatures(4)
x1 = Symbol('x1')
x2 = Symbol('x2')
x3 = Symbol('x3')
XX = np.random.rand(1000, 3)
preprocess_symXX = poly.fit_transform([x1, x2, x3])
preprocess_XX = poly.fit_transform(XX)
print preprocess_symXX
It was awesome. It will generate output, for example [1, x1, x2, x3, x1**2, ... ], that will let me know what functions of the polynomial my columns have preprocess_XX.
But now, when I do this, he complains TypeError: can't convert expression to float. This exception occurs due to a function in sklearn.utils.validation, called check_array(), which attempts to input the input signal poly.fit_transform()into dtype=float.
, , fit_transform()?, , sympy fit_transform?