在我的代码中,它会引发运行时错误。在这里,我试图为回归数据拟合 RFE。
from sklearn.feature_selection import RFE
from sklearn.svm import SVR
from sklearn.feature_selection import SelectKBest
from sklearn.preprocessing import *
scaler = StandardScaler().fit(trainFeatures)
xscaled = scaler.transform(trainFeatures)
estimator = SVR()
selector = RFE(estimator, dimension, step=1)
selector = selector.fit(xscaled, trainOutput.ravel())
selectedFeatures = selector.transform(xscaled)