#' @title Feed Forward
#'
#' @export
feed_forward <- function(x = matrix(c(1, 2)), res) {
# Calculate feed forward activation layer values sigma(w . a + b)
wInputs <- list()
activations <- list(x)
for (i in 1:(res$layers - 1)) {
weightedInput <- res$weights[[i]] %*% x %>% `+`(res$bias[[i]])
wInputs %<>% c(weightedInput %>% list)
x <- weightedInput %>% cerebrum::sig()
activations %<>% c(x %>% list)
}
# Return weighted inputs and the activation values
return(
list(
activations = activations,
wInputs = wInputs
)
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.