inst/examples/ex_crossentropy.R

ps <- c(0, 1, 1, 0, 1, 0, 0, 1, 0, 0)
qs <- c(0, 0, 0, 0, 0, 1, 1, 0, 0, 1)
cross_entropy(ps, qs)      # 1.003530
cross_entropy(qs, ps)      # 0.912454

Try the rinform package in your browser

Any scripts or data that you put into this service are public.

rinform documentation built on April 1, 2018, 12:12 p.m.