Quick follow-up, I did a little more digging and I think this will work for computing AUC for PR curve:
library(keras)
library(tensorflow)
library(tidyverse)
y <- mtcars$vs %>% to_categorical()
x <- mtcars %>% select(-vs) %>% as.matrix()
model <- keras_model_sequential()
model %>%
layer_dense(10, input_shape = c(10)) %>%
layer_dense(units = 2, activation = "softmax")
summary(model)
model %>%
compile(
optimizer = "rmsprop",
loss = "categorical_crossentropy",
metrics = tf$keras$metrics$AUC()
)
model %>%
fit(
x = x,
y = y,
epoch = 100
)