我有这样的管道:
lin_reg_pipeline = Pipeline([
('polynomial_features', PolynomialFeatures()),
('normalize_polynomial_features', StandardScaler()),
('feature_selection', RFE(LinearRegression(), verbose=1)),
('lin_reg', LinearRegression())
])
现在,在网格搜索中安装此管道时,我指定要调整的以下参数:
params = {
'polynomial_features__degree': [1, 2, 3],
'feature_selection__n_features_to_select': st.randint(10, 100)
}
我有没有办法将n_features_to_select设置为数据集中要素总量的百分比?因为我不知道会添加多少个功能PolynomialFeatures()
。
提前致谢,
凯文