我已经开始用精确性和回忆性来评估一个随机森林分类器。然而,尽管训练和测试集在分类器的CPU和GPU实现上是相同的,但我看到了返回的评估分数的差异。这是一个已知的错误在图书馆偶然?
这两个代码示例都在下面供参考。
Scikit-学习(CPU)
from sklearn.metrics import recall_score, precision_score
from sklearn.ensemble import RandomForestClassifier
rf_cpu = RandomForestClassifier(n_estimators=5000, n_jobs=-1)
rf_cpu.fit(X_train, y_train)
rf_cpu_pred = clf.predict(X_test)
recall_score(rf_cpu_pred, y_test)
precision_score(rf_cpu_pred, y_test)
CPU Recall: 0.807186
CPU Precision: 0.82095H2O4GPU (GPU)
from h2o4gpu.metrics import recall_score, precision_score
from h2o4gpu import RandomForestClassifier
rf_gpu = RandomForestClassifier(n_estimators=5000, n_gpus=1)
rf_gpu.fit(X_train, y_train)
rf_gpu_pred = clf.predict(X_test)
recall_score(rf_gpu_pred, y_test)
precision_score(rf_gpu_pred, y_test)
GPU Recall: 0.714286
GPU Precision: 0.809988发布于 2018-11-13 23:33:56
修正:实现了精确性和召回性输入的顺序错误。按照Scikit-Learn 文档的说法,订单总是(y_true, y_pred)。
修正的评估代码
recall_score(y_test, rf_gpu_pred)
precision_score(y_test, rf_gpu_pred)https://stackoverflow.com/questions/53290612
复制相似问题