keras_model: Keras Model

Description Usage Arguments See Also Examples

View source: R/model.R

Description

A model is a directed acyclic graph of layers.

Usage

1
keras_model(inputs, outputs = NULL)

Arguments

inputs

Input layer

outputs

Output layer

See Also

Other model functions: compile.keras.engine.training.Model(), evaluate.keras.engine.training.Model(), evaluate_generator(), fit.keras.engine.training.Model(), fit_generator(), get_config(), get_layer(), keras_model_sequential(), multi_gpu_model(), pop_layer(), predict.keras.engine.training.Model(), predict_generator(), predict_on_batch(), predict_proba(), summary.keras.engine.training.Model(), train_on_batch()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
library(keras)

# input layer
inputs <- layer_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 
  optimizer = 'rmsprop',
  loss = 'categorical_crossentropy',
  metrics = c('accuracy')
)

## End(Not run)

dfalbel/keras documentation built on Nov. 27, 2019, 8:16 p.m.