Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Python中校准R模型对象_Python_Machine Learning_Scikit Learn_Xgboost_Calibration - Fatal编程技术网

在Python中校准R模型对象

在Python中校准R模型对象,python,machine-learning,scikit-learn,xgboost,calibration,Python,Machine Learning,Scikit Learn,Xgboost,Calibration,我有一个用R开发的XGBoost模型,我想用Python对其进行校准 它存储为xgb.model文件。 我已经使用以下代码行成功地在Python中加载了它 model = xgboost.Booster(model_file="path_to_xgb.model") 我正在使用以下代码生成校准器对象,但在尝试安装校准器时,我得到一个运行时错误 calibrator = CalibratedClassifierCV(model, cv = 'prefit', method =

我有一个用R开发的XGBoost模型,我想用Python对其进行校准

它存储为
xgb.model
文件。 我已经使用以下代码行成功地在Python中加载了它

model = xgboost.Booster(model_file="path_to_xgb.model")
我正在使用以下代码生成校准器对象,但在尝试安装校准器时,我得到一个运行时错误

calibrator = CalibratedClassifierCV(model, cv = 'prefit', method = 'sigmoid')
calibrator.fit(Xtrain,Ytrain)
我看到的错误是

  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sklearn/calibration.py", line 297, in _preproc
raise RuntimeError('classifier has no decision_function or '
RuntimeError: classifier has no decision_function or predict_proba method.
我注意到了数据集的不相交性,但非常感谢在如何处理这一问题上能得到的任何帮助


谢谢

您需要先将XGBoost
助推器
对象包装到与Scikit学习兼容的对象中。

您好!谢谢你的提示。你对我怎么做有什么建议吗?