Skip to content

Instantly share code, notes, and snippets.

@conormm
Last active March 3, 2018 13:28
Show Gist options
  • Select an option

  • Save conormm/11a3a20605b98ad579b9e20d02419eca to your computer and use it in GitHub Desktop.

Select an option

Save conormm/11a3a20605b98ad579b9e20d02419eca to your computer and use it in GitHub Desktop.
library(tidyverse)
# create range of probabilities
probs <- seq(0, 1, 0.001)
# apply log loss over full range of propabilites
t1 <- logloss(1, probs)
t0 <- logloss(0, probs)
# tidy the data
df <- data.frame(probs = probs, actual_0 = t0, actual_1 = t1)
df <- df %>% gather(label, logloss, actual_0, actual_1)
df <- df %>% filter(logloss != Inf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment