当我使用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