我想获得eli5的特征置换得分,但继续获得ValueError: Unknown label type: 'continuous'
我该如何解决?
import eli5
from eli5.sklearn import PermutationImportance
from sklearn.svm import SVC
from sklearn.feature_selection import SelectFromModel
my_model = RandomForestClassifier()
# ... load data
clf = lgb.LGBMClassifier(nthread=4, boosting_type= 'gbdt',
metric= 'auc', n_estimators= 5000 )
perm = PermutationImportance(clf, cv=5)
perm.fit(df[feat], df.CSI)
# perm.feature_importances_ attribute is now available, it can be used
# for feature selection - let's e.g. select features which increase
# accuracy by at least 0.05:
sel = SelectFromModel(perm, threshold=0.05, prefit=True)
X_trans = sel.transform(X)
答案 0 :(得分:0)
此问题已解决:
perm.fit(df[feat].values, df.CSI.values)