Skip to content

Instantly share code, notes, and snippets.

@MaximilianPi
Last active June 6, 2018 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MaximilianPi/a3fcf3eba6d1aaa374a3ac1bf7dfa9f6 to your computer and use it in GitHub Desktop.
Save MaximilianPi/a3fcf3eba6d1aaa374a3ac1bf7dfa9f6 to your computer and use it in GitHub Desktop.
use_session_with_seed(1,disable_parallel_cpu = FALSE)
model = keras_model_sequential()
model %>%
layer_dense(input_shape = ncol(x), units = 10, activation = "relu") %>%
layer_dropout(0.2) %>%
layer_dense(units = 10, activation = "relu") %>%
layer_dropout(0.2) %>%
layer_dense(units = 3, activation = "softmax")
model %>%
compile(
loss = "categorical_crossentropy",
optimizer = "adagrad",
metrics = "accuracy"
)
fit = model %>%
fit(
x = x,
y = y,
shuffle = T,
validation_split = 0.3,
epochs = 200,
batch_size = 5
)
plot(fit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment