Skip to content

Instantly share code, notes, and snippets.

@rvndbalaji
Created July 24, 2018 15:58
Show Gist options
  • Save rvndbalaji/4fdc661a3fedd937e5341da4e39c8fc5 to your computer and use it in GitHub Desktop.
Save rvndbalaji/4fdc661a3fedd937e5341da4e39c8fc5 to your computer and use it in GitHub Desktop.
#Using Keras
model = keras_model_sequential()
model %>%
layer_dense(units = 3, input_shape = c(5), activation = 'relu') %>%
layer_dense(units = 2, activation = 'relu') %>%
layer_dense(units = 1, activation = 'sigmoid')
model %>% compile(
loss = 'binary_crossentropy',
optimizer = optimizer_adam(),
metrics = c('accuracy')
)
history = model %>% fit(
x_train,y_train,
epochs = 130, batch_size = 2000,
validation_split = 0.2
)
#Output
#loss [1] 0.08656487
#acc [1] 0.9869172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment