View source: R/model-creation.R
| keras_model | R Documentation |
A model is a directed acyclic graph of layers.
keras_model(inputs = NULL, outputs = NULL, ...)
inputs |
Input tensor(s) (from |
outputs |
Output tensors (from calling layers with |
... |
Any additional arguments |
A Model instance.
library(keras3)
# input tensor
inputs <- keras_input(shape = c(784))
# outputs compose input + dense layers
predictions <- inputs |>
layer_dense(units = 64, activation = 'relu') |>
layer_dense(units = 64, activation = 'relu') |>
layer_dense(units = 10, activation = 'softmax')
# create and compile model
model <- keras_model(inputs = inputs, outputs = predictions)
model |> compile(
optimizer = 'rmsprop',
loss = 'categorical_crossentropy',
metrics = c('accuracy')
)
Other model functions:
get_config()
get_layer()
get_state_tree()
keras_model_sequential()
pop_layer()
set_state_tree()
summary.keras.src.models.model.Model()
Other model creation:
keras_input()
keras_model_sequential()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.