Using PermutationImportance with LGBMClassifier causes ValueError: Unknown label type: 'continuous'
Using PermutationImportance with LGBMClassifier causes ValueError: Unknown label type: 'continuous'
我想得到 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)
已解决问题:
perm.fit(df[feat].values, df.CSI.values)
我想得到 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)
已解决问题:
perm.fit(df[feat].values, df.CSI.values)