def get_polynomials(features, poly_degree):
r"""Generate interactions that are products of distinct features.
Parameters
----------
features : pandas.DataFrame
Dataframe containing the features for generating interactions.
poly_degree : int
The degree of the polynomial features.
Returns
-------
poly_features : numpy array
The interaction features only.
References
----------
You can find more information on polynomial interactions here [POLY]_.
.. [POLY] http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.PolynomialFeatures.html
"""
polyf = PolynomialFeatures(interaction_only=True,
degree=poly_degree,
include_bias=False)
poly_features = polyf.fit_transform(features)
return poly_features
#
# Function get_text_features
#
评论列表
文章目录