forked from bkrai/DeepLearningR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExperiment.R File
More file actions
24 lines (23 loc) · 769 Bytes
/
Experiment.R File
File metadata and controls
24 lines (23 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Flags
FLAGS <- flags(flag_integer('dense_units', 32))
# Model
model <- keras_model_sequential() %>%
layer_dense(units = FLAGS$dense_units,
activation = 'relu',
input_shape = c(21)) %>%
layer_dropout(rate = 0.1) %>%
layer_dense(units = 16,
activation = 'relu') %>%
layer_dropout(rate = 0.1) %>%
layer_dense(units = 3, activation = 'softmax')
# Compile
model %>% compile(loss = 'categorical_crossentropy',
optimizer = 'adam',
metrics = 'accuracy')
# Fit
history <- model %>%
fit(training,
trainLabels,
epochs = 50,
batch_size = 32,
validation_split = 0.2)