Skip to content

Commit

Permalink
surprisal_prob set to 0 for infinite surprisal values
Browse files Browse the repository at this point in the history
  • Loading branch information
robjhyndman committed Sep 16, 2024
1 parent db1a197 commit fb25069
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions R/surprisal_prob.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ surprisal_prob <- function(
prob <- (rank(dist_y) - 1) / length(dist_y)
p <- 1 - approx(dist_y, prob, xout = g, rule = 2, ties = mean)$y
}
p[g == Inf] <- 0
return(p)
}

Expand Down

0 comments on commit fb25069

Please sign in to comment.