I am using package
Keras in R to do a neural network. How may I extract the output from a hidden layer? I found an example in python, but it is just I have no idea how to do that in R.
You can get the answer at https://keras.rstudio.com/articles/faq.html
Here it is:
model <- ... # create the original model layer_name <- 'my_layer' intermediate_layer_model <- keras_model(inputs = model$input, outputs = get_layer(model, layer_name)$output) intermediate_output <- predict(intermediate_layer_model, data)