_catboost.CatBoostError: C:/Program Files (x86)/Go Agent/pipelines/BuildMaster/catboost.git/catboost
Posted Data+Science+Insight
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了_catboost.CatBoostError: C:/Program Files (x86)/Go Agent/pipelines/BuildMaster/catboost.git/catboost相关的知识,希望对你有一定的参考价值。
_catboost.CatBoostError: C:/Program Files (x86)/Go Agent/pipelines/BuildMaster/catboost.git/catboost/libs/data/model_dataset_compatibility.cpp:81: At position 0 should be feature with name featureA (found featureB)
目录
问题:
#模型保存
# Import pickle Package
import pickle
# Save the Modle to file in the current working directory
pkl_name = "break_model1.pkl"
with open(pkl_name, 'wb') as file:
pickle.dump(cat_model, file)
#模型加载预测
# Load the Model back from file
with open(pkl_name, 'rb') as file:
Pickled_Model = pickle.load(file)
Pickled_Model
Pickled_Model.predict_proba(features_test)[:,1]
解决:
如下示例:犯了三个错误:
第一,特征的顺序变了;A特征跑到了B特征后面;
第二,多了一个模型训练没有见过的特征E;
第三,少了一个模型训练缺少的特征C
#模型训练的特征列表;
feature_list = [featureA、featureB、featureC、featureD]
#模型预测的特征列表;
feature_list = [featureB、featureA、featureE、featureD]
#正解
feature_list = [featureA、featureB、featureC、featureD]
input_data = data[feature_list]
完整错误:
_catboost.CatBoostError: C:/Program Files (x86)/Go Agent/pipelines/BuildMaster/catboost.git/catboost/libs/data/model_dataset_compatibility.cpp:81: At position 0 should be feature with name featureA (found featureB)
以上是关于_catboost.CatBoostError: C:/Program Files (x86)/Go Agent/pipelines/BuildMaster/catboost.git/catboost的主要内容,如果未能解决你的问题,请参考以下文章