如何解决XGBoost评分功能与培训和评估不符
当我使用score()
时,我的训练损失(损失,用于验证和培训)不匹配分数。它是一个二进制分类(Y是一个0或1的1d数组)。我想score()
正在使用我提供的loss_function
。如果没有,我想知道如何更改此指标。
model = CatBoostClassifier(iterations=iterations,early_stopping_rounds=early_stopping_rounds,learning_rate=learning_rate,loss_function='Logloss',depth=depth)
model.fit(X_train_cat.iloc[batch*batch_size:(batch+1)*batch_size],y_train.iloc[batch*batch_size:(batch+1)*batch_size],eval_set=(X_val_cat,y_val),cat_features=index_categ_feat,use_best_model=True)
输出
...
99: learn: 0.3745852 test: 0.4720675 best: 0.4720675 (99) total: 292ms remaining: 0us
bestTest = 0.4720675457
bestIteration = 99
Out[45]: <catboost.core.CatBoostClassifier at 0x210aa5f25f8>
model.score(X_val_cat,y_val)
Out[46]: 0.8064516129032258
model.score(X_train_cat,y_train)
Out[47]: 0.9014014014014013
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。