Created
October 26, 2022 23:58
-
-
Save mcfrank/8d71e49520c70b87ebc59bae2ebf5c0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# delta rule formula | |
# (i-o) o (1-o) | |
library(tidyverse) | |
d <- expand_grid(i = seq(0.05,.95,.05), | |
o = seq(0.05,.95,.05)) |> | |
mutate(last_part = o * (1-o), | |
first_part = abs(i-o), | |
delta = abs((i-o) * o * (1-o)), | |
divergence = i * log(i/o)) | |
d_wide <- d |> | |
pivot_longer(last_part:divergence, names_to = "measure", values_to = "value") | |
ggplot(d_wide, aes(x = i, y = value, col = o)) + | |
geom_line(aes(group = as.factor(o))) + | |
facet_wrap(~measure, scales = "free_y") + | |
ylab("curiosity") + | |
xlab("input value") + | |
viridis::scale_color_viridis(name = "output value") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment