Reputation: 21
I did some kind of data analitycs with the h2o.ai platform in R and I want to receive the AUCPR curve for the model / the prediction.
I already tried to use "PRROC" package, but it sees either not working or to slow for my dataset (1.4 Million instances). For the other available packages I don't really know how i can extract the data from h2o model.
pr <- h2o.predict(V_PUF_AGG1_NPI_ALLEX_BINAR.drf.tt.standard, data.test)
gives me a prediction matrix (which i can use for further proceeding?):
predict p1 p2
1 1 0.9999427 5.731940e-05
2 1 0.9999606 3.939748e-05
3 1 0.9999744 2.556443e-05
4 1 0.9999659 3.413081e-05
5 1 0.9999606 3.939748e-05
6 1 0.9999545 4.554749e-05
[987141 rows x 3 columns]
So I'm searching for a quick solution to plot AUCPR curve.
It's easy to get the ROC curve, but there is no way to get an AUCPR curve directly from h2o:
plot(h2o.performance(V_PUF_AGG1_NPI_ALLEX_BINAR.drf.tt.standard, valid=T), type='roc')
Thanks - John
Upvotes: 1
Views: 1113
Reputation: 104
You can plot the PRROC of e.g. the test set in the following way, where mod
is your H2O model object and test_hf
is your test set.
library(tidyverse)
perf <- h2o.performance(mod,test_hf)
metrics <- as.data.frame(h2o.metric(perf))
metrics %>%
ggplot(aes(recall,precision)) +
geom_line() +
theme_minimal()
Upvotes: 4