我尝试使用H2O创建一些二元分类问题的机器学习模型,测试结果非常好。但是当我检查时发现了一些奇怪的事情。出于好奇,我尝试打印模型对测试集的预测结果。结果发现我的模型实际上总是预测0(负面),但AUC约为0.65,精度不为0.0。然后我尝试使用Scikit-learn来比较指标分数,结果(如预期)不同。Scikit-learn得出了0.0的精度和0.5的AUC分数,我认为这是正确的。以下是我使用的代码:
model = h2o.load_model(model_path)
predictions = model.predict(Test_data).as_data_frame()
# H2O version to print the AUC score
auc = model.model_performance(Test_data).auc()
# Python version to print the AUC score
auc_sklearn = sklearn.metrics.roc_auc_score(y_true, predictions['predict'].tolist())
有什么想法吗?提前感谢!