scikit-learn - 带有 Skear XGBoost 和 Sklearn 校准分类器 CV 的 TypeError
问题描述
我正在尝试校准 XGBClassifier 的输出概率。
我提供了示例代码,
x_train, x_test, y_train, y_test = train_test_split(x_var, y_var, test_size = 0.2, shuffle = False)
new_mod2 = xgb.XGBClassifier(scale_pos_weight = 1, eta = 0.3, nthread = 10, learning_rate = 0.05, max_depth = 2, n_estimators = 180, objective = 'binary:logistic' )
calibrated = CalibratedClassifierCV( base_estimator = new_mod2,method = 'Isotonic', cv=3)
calibrated.fit(X = x_train, y = y_train)
但是在运行 calibrated.fit() 函数时,出现以下错误:
TypeError: predict_proba() got an unexpected keyword argument 'X'
我的理解是 calibratedclassifiercv 应该与 sklearn xgboost 包装器一起使用。
然而,校准后的分类器 cv 似乎将不正确的变量传递给 xgboost 的 predict_proba() 方法。
是否有任何原因可能会发生这种情况?
解决方案
推荐阅读
- r - 我的闪亮应用程序无法在闪亮的 io 服务器上正确部署
- dynamic-programming - 我如何记住我的回溯算法并使用动态编程?
- javascript - SyntaxError 不断出现
- bixby - 当话语显示为未学习时,如何在新 UI 中强制学习?
- java - 为什么找不到 springBoot {}?
- powershell - 为什么列被跳过?
- android - 我们如何使用批处理脚本将所有应用程序从 android(adb) 复制到 PC?
- javascript - 如何将内部函数值作为参数传递给其回调
- c++ - 如何在 C++ 中编写一个递归函数模板来检查作为参数提供的两个堆栈是否相同?
- php - 带有标准 xml 信封和 pdf 附件的肥皂服务的 CURL 请求