问题

我正在尝试在 Santander Customer Transformation database 运行LOFORification,我遇到了以下错误:

 import pandas as pd
from sklearn.model_selection import KFold
from lofo.lofo_importance import LOFOImportance
from sklearn.metrics import roc_auc_score

df_Train.sort_values("target", inplace=True)

cv = KFold(n_splits=4, shuffle=False, random_state=42)
target = "target"
features = [col for col in df_Train.columns if col != target]

lofo = LOFOImportance(df_Train, features, target, cv=cv, scoring = 'roc_auc')
importance_df = lofo.get_importance()
 

有没有人有同样的问题?

  最佳答案

如果您查看LOFOImportance.__init__’s 签名,您将看到第二个位置参数是scoring:

 def __init__(self, dataset, scoring, model=None, fit_params=None, cv=4, n_jobs=None):
 

因此你的代码

 lofo = LOFOImportance(df_Train, features, target, cv=cv, scoring = 'roc_auc')
 

scoring提供2个区别值(如错误所说):一个作为位置参数features,第二个作为keyword-varties,字符串roc_auc.

  相同标签的其他问题

python