Update: The original code has been updated to use the tidymodels init_split() function, rather than using the indicies method which originally used setdiff, which now may have a conflict between base R and the tidyverse.
Thank you
A big thank you to Leon Jessen for posting his code on github.
Building a simple neural network using Keras and Tensorflow
I have forked his project on github and put his code into an R Notebook so we can run it in class.
The following is a minimal example for building your first simple artificial neural network using Keras and TensorFlow for R.
You can install the Keras for R package from CRAN as follows:
# install.packages("keras")
TensorFlow is the default backend engine. TensorFlow and Keras can be installed as follows:
# library(keras)
# install_keras()
Naturally, we will also need Tidyverse.
# Install from CRAN
# install.packages("tidyverse")
# Or the development version from GitHub
# install.packages("devtools")
# devtools::install_github("hadley/tidyverse")
Once installed, we simply load the libraries.
library("keras")
suppressMessages(library("tidyverse"))
Right, let’s get to it!
The famous (Fisher’s or Anderson’s) iris data set contains a total of 150 observations of 4 input features Sepal.Length, Sepal.Width, Petal.Length and Petal.Width and 3 output classes setosa versicolor and virginica, with 50 observations in each class. The distributions of the feature values looks like so:
iris_tib <- as_tibble(iris)
iris_tib
iris_tib %>% pivot_longer(names_to = "feature", values_to = "value", -Species) %>%
ggplot(aes(x = feature, y = value, fill = Species)) +
geom_violin(alpha = 0.5, scale = "width") +
theme_bw()
Our aim is to connect the 4 input features to the correct output class using an artificial neural network. For this task, we have chosen the following simple architecture with one input layer with 4 neurons (one for each feature), one hidden layer with 4 neurons and one output layer with 3 neurons (one for each class), all fully connected.
Our artificial neural network will have a total of 35 parameters: 4 for each input neuron connected to the hidden layer, plus an additional 4 for the associated first bias neuron and 3 for each of the hidden neurons connected to the output layer, plus an additional 3 for the associated second bias neuron, i.e. \(4 \times 4 + 4 + 4 \times 3 + 3=35\)
We start with slightly wrangling the iris data set by renaming and scaling the features and converting character labels to numeric.
set.seed(265509)
nn_dat <- iris_tib %>%
mutate(sepal_length = scale(Sepal.Length),
sepal_width = scale(Sepal.Width),
petal_length = scale(Petal.Length),
petal_width = scale(Petal.Width),
class_label = as.numeric(Species) - 1) %>%
select(sepal_length, sepal_width, petal_length, petal_width, class_label)
nn_dat %>% head()
Then, we create indices for splitting the iris data into a training and a test data set. We set aside 20% of the data for testing.
library(tidymodels)
set.seed(364)
n <- nrow(nn_dat)
n
[1] 150
iris_parts <- nn_dat %>%
initial_split(prop = 0.8)
train <- iris_parts %>%
training()
test <- iris_parts %>%
testing()
list(train, test) %>%
map_int(nrow)
[1] 121 29
n_total_samples <- nrow(nn_dat)
n_train_samples <- nrow(train)
n_test_samples <- nrow(test)
Note that the functions in the keras package are expecting the data to be in a matrix object and not a tibble. So as.matrix is added at the end of each line.
x_train <- train %>% select(-class_label) %>% as.matrix()
y_train <- train %>% select(class_label) %>% as.matrix() %>% to_categorical()
x_test <- test %>% select(-class_label) %>% as.matrix()
y_test <- test %>% select(class_label) %>% as.matrix() %>% to_categorical()
dim(y_train)
[1] 121 3
dim(y_test)
[1] 29 3
With the data in place, we now set the architecture of our neural network.
model <- keras_model_sequential()
model %>%
layer_dense(units = 4, activation = 'relu', input_shape = 4) %>%
layer_dense(units = 3, activation = 'softmax')
model %>% summary
Model: "sequential_3"
____________________________________________________________________________
Layer (type) Output Shape Param #
============================================================================
dense_7 (Dense) (None, 4) 20
____________________________________________________________________________
dense_6 (Dense) (None, 3) 15
============================================================================
Total params: 35
Trainable params: 35
Non-trainable params: 0
____________________________________________________________________________
Next, the architecture set in the model needs to be compiled.
model %>% compile(
loss = 'categorical_crossentropy',
optimizer = optimizer_rmsprop(),
metrics = c('accuracy')
)
Lastly we fit the model and save the training progress in the history object.
Try changing the validation_split from 0 to 0.2 to see the validation_loss.
history <- model %>% fit(
x = x_train, y = y_train,
epochs = 200,
batch_size = 20,
validation_split = 0.2
)
Epoch 1/200
1/5 [=====>........................] - ETA: 0s - loss: 1.3388 - accuracy: 0.3000
5/5 [==============================] - 0s 626us/step - loss: 1.2012 - accuracy: 0.3958
5/5 [==============================] - 1s 116ms/step - loss: 1.2012 - accuracy: 0.3958 - val_loss: 1.8751 - val_accuracy: 0.0000e+00
Epoch 2/200
1/5 [=====>........................] - ETA: 0s - loss: 1.0707 - accuracy: 0.4500
5/5 [==============================] - 0s 552us/step - loss: 1.1734 - accuracy: 0.3958
5/5 [==============================] - 0s 39ms/step - loss: 1.1734 - accuracy: 0.3958 - val_loss: 1.8398 - val_accuracy: 0.0000e+00
Epoch 3/200
1/5 [=====>........................] - ETA: 0s - loss: 1.0602 - accuracy: 0.4500
5/5 [==============================] - 0s 3ms/step - loss: 1.1548 - accuracy: 0.3958
5/5 [==============================] - 0s 33ms/step - loss: 1.1548 - accuracy: 0.3958 - val_loss: 1.8107 - val_accuracy: 0.0000e+00
Epoch 4/200
1/5 [=====>........................] - ETA: 0s - loss: 1.0990 - accuracy: 0.5000
5/5 [==============================] - 0s 512us/step - loss: 1.1382 - accuracy: 0.3958
5/5 [==============================] - 0s 26ms/step - loss: 1.1382 - accuracy: 0.3958 - val_loss: 1.7815 - val_accuracy: 0.0000e+00
Epoch 5/200
1/5 [=====>........................] - ETA: 0s - loss: 1.2690 - accuracy: 0.3000
5/5 [==============================] - 0s 2ms/step - loss: 1.1236 - accuracy: 0.3958
5/5 [==============================] - 0s 32ms/step - loss: 1.1236 - accuracy: 0.3958 - val_loss: 1.7558 - val_accuracy: 0.0000e+00
Epoch 6/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8600 - accuracy: 0.6000
5/5 [==============================] - 0s 2ms/step - loss: 1.1097 - accuracy: 0.3958
5/5 [==============================] - 0s 31ms/step - loss: 1.1097 - accuracy: 0.3958 - val_loss: 1.7269 - val_accuracy: 0.0000e+00
Epoch 7/200
1/5 [=====>........................] - ETA: 0s - loss: 1.1558 - accuracy: 0.3000
5/5 [==============================] - 0s 569us/step - loss: 1.0960 - accuracy: 0.3958
5/5 [==============================] - 0s 26ms/step - loss: 1.0960 - accuracy: 0.3958 - val_loss: 1.7008 - val_accuracy: 0.0000e+00
Epoch 8/200
1/5 [=====>........................] - ETA: 0s - loss: 1.0330 - accuracy: 0.4500
5/5 [==============================] - 0s 697us/step - loss: 1.0831 - accuracy: 0.3958
5/5 [==============================] - 0s 27ms/step - loss: 1.0831 - accuracy: 0.3958 - val_loss: 1.6750 - val_accuracy: 0.0000e+00
Epoch 9/200
1/5 [=====>........................] - ETA: 0s - loss: 1.0609 - accuracy: 0.3500
5/5 [==============================] - 0s 3ms/step - loss: 1.0705 - accuracy: 0.4062
5/5 [==============================] - 0s 32ms/step - loss: 1.0705 - accuracy: 0.4062 - val_loss: 1.6506 - val_accuracy: 0.0000e+00
Epoch 10/200
1/5 [=====>........................] - ETA: 0s - loss: 1.1090 - accuracy: 0.4500
5/5 [==============================] - 0s 800us/step - loss: 1.0585 - accuracy: 0.4062
5/5 [==============================] - 0s 29ms/step - loss: 1.0585 - accuracy: 0.4062 - val_loss: 1.6273 - val_accuracy: 0.0000e+00
Epoch 11/200
1/5 [=====>........................] - ETA: 0s - loss: 1.1656 - accuracy: 0.4000
5/5 [==============================] - 0s 3ms/step - loss: 1.0471 - accuracy: 0.4167
5/5 [==============================] - 0s 34ms/step - loss: 1.0471 - accuracy: 0.4167 - val_loss: 1.6086 - val_accuracy: 0.0000e+00
Epoch 12/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9748 - accuracy: 0.4000
5/5 [==============================] - 0s 3ms/step - loss: 1.0362 - accuracy: 0.4167
5/5 [==============================] - 0s 30ms/step - loss: 1.0362 - accuracy: 0.4167 - val_loss: 1.5883 - val_accuracy: 0.0000e+00
Epoch 13/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8675 - accuracy: 0.5500
5/5 [==============================] - 0s 3ms/step - loss: 1.0256 - accuracy: 0.4479
5/5 [==============================] - 0s 32ms/step - loss: 1.0256 - accuracy: 0.4479 - val_loss: 1.5667 - val_accuracy: 0.0000e+00
Epoch 14/200
1/5 [=====>........................] - ETA: 0s - loss: 1.2064 - accuracy: 0.3000
5/5 [==============================] - 0s 630us/step - loss: 1.0151 - accuracy: 0.4583
5/5 [==============================] - 0s 26ms/step - loss: 1.0151 - accuracy: 0.4583 - val_loss: 1.5503 - val_accuracy: 0.0000e+00
Epoch 15/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9733 - accuracy: 0.5000
5/5 [==============================] - 0s 642us/step - loss: 1.0052 - accuracy: 0.4688
5/5 [==============================] - 0s 26ms/step - loss: 1.0052 - accuracy: 0.4688 - val_loss: 1.5308 - val_accuracy: 0.0000e+00
Epoch 16/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8383 - accuracy: 0.6000
5/5 [==============================] - 0s 604us/step - loss: 0.9959 - accuracy: 0.4792
5/5 [==============================] - 0s 26ms/step - loss: 0.9959 - accuracy: 0.4792 - val_loss: 1.5137 - val_accuracy: 0.0000e+00
Epoch 17/200
1/5 [=====>........................] - ETA: 0s - loss: 1.1821 - accuracy: 0.3500
5/5 [==============================] - 0s 2ms/step - loss: 0.9867 - accuracy: 0.4896
5/5 [==============================] - 0s 31ms/step - loss: 0.9867 - accuracy: 0.4896 - val_loss: 1.4975 - val_accuracy: 0.0000e+00
Epoch 18/200
1/5 [=====>........................] - ETA: 0s - loss: 1.0665 - accuracy: 0.5500
5/5 [==============================] - 0s 3ms/step - loss: 0.9785 - accuracy: 0.5625
5/5 [==============================] - 0s 32ms/step - loss: 0.9785 - accuracy: 0.5625 - val_loss: 1.4783 - val_accuracy: 0.0000e+00
Epoch 19/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9199 - accuracy: 0.5500
5/5 [==============================] - 0s 2ms/step - loss: 0.9698 - accuracy: 0.5833
5/5 [==============================] - 0s 33ms/step - loss: 0.9698 - accuracy: 0.5833 - val_loss: 1.4582 - val_accuracy: 0.0000e+00
Epoch 20/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8482 - accuracy: 0.7000
5/5 [==============================] - 0s 693us/step - loss: 0.9616 - accuracy: 0.6146
5/5 [==============================] - 0s 26ms/step - loss: 0.9616 - accuracy: 0.6146 - val_loss: 1.4403 - val_accuracy: 0.0000e+00
Epoch 21/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8360 - accuracy: 0.8000
5/5 [==============================] - 0s 609us/step - loss: 0.9538 - accuracy: 0.6146
5/5 [==============================] - 0s 28ms/step - loss: 0.9538 - accuracy: 0.6146 - val_loss: 1.4225 - val_accuracy: 0.0000e+00
Epoch 22/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9203 - accuracy: 0.6000
5/5 [==============================] - 0s 1ms/step - loss: 0.9457 - accuracy: 0.6354
5/5 [==============================] - 0s 29ms/step - loss: 0.9457 - accuracy: 0.6354 - val_loss: 1.4073 - val_accuracy: 0.0000e+00
Epoch 23/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8758 - accuracy: 0.7500
5/5 [==============================] - 0s 2ms/step - loss: 0.9382 - accuracy: 0.6771
5/5 [==============================] - 0s 31ms/step - loss: 0.9382 - accuracy: 0.6771 - val_loss: 1.3912 - val_accuracy: 0.0000e+00
Epoch 24/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9551 - accuracy: 0.7000
5/5 [==============================] - 0s 2ms/step - loss: 0.9309 - accuracy: 0.6875
5/5 [==============================] - 0s 31ms/step - loss: 0.9309 - accuracy: 0.6875 - val_loss: 1.3763 - val_accuracy: 0.0000e+00
Epoch 25/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8751 - accuracy: 0.6500
5/5 [==============================] - 0s 2ms/step - loss: 0.9234 - accuracy: 0.6979
5/5 [==============================] - 0s 32ms/step - loss: 0.9234 - accuracy: 0.6979 - val_loss: 1.3585 - val_accuracy: 0.0000e+00
Epoch 26/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9436 - accuracy: 0.7500
5/5 [==============================] - 0s 2ms/step - loss: 0.9160 - accuracy: 0.6979
5/5 [==============================] - 0s 31ms/step - loss: 0.9160 - accuracy: 0.6979 - val_loss: 1.3445 - val_accuracy: 0.0000e+00
Epoch 27/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9072 - accuracy: 0.7000
5/5 [==============================] - 0s 560us/step - loss: 0.9085 - accuracy: 0.6979
5/5 [==============================] - 0s 28ms/step - loss: 0.9085 - accuracy: 0.6979 - val_loss: 1.3290 - val_accuracy: 0.0000e+00
Epoch 28/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9360 - accuracy: 0.6000
5/5 [==============================] - 0s 538us/step - loss: 0.9012 - accuracy: 0.6979
5/5 [==============================] - 0s 26ms/step - loss: 0.9012 - accuracy: 0.6979 - val_loss: 1.3149 - val_accuracy: 0.0000e+00
Epoch 29/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8873 - accuracy: 0.8000
5/5 [==============================] - 0s 606us/step - loss: 0.8936 - accuracy: 0.6979
5/5 [==============================] - 0s 27ms/step - loss: 0.8936 - accuracy: 0.6979 - val_loss: 1.3004 - val_accuracy: 0.0000e+00
Epoch 30/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7758 - accuracy: 0.8500
5/5 [==============================] - 0s 3ms/step - loss: 0.8860 - accuracy: 0.7188
5/5 [==============================] - 0s 33ms/step - loss: 0.8860 - accuracy: 0.7188 - val_loss: 1.2868 - val_accuracy: 0.0000e+00
Epoch 31/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7663 - accuracy: 0.9000
5/5 [==============================] - 0s 3ms/step - loss: 0.8789 - accuracy: 0.7292
5/5 [==============================] - 0s 34ms/step - loss: 0.8789 - accuracy: 0.7292 - val_loss: 1.2715 - val_accuracy: 0.0000e+00
Epoch 32/200
1/5 [=====>........................] - ETA: 0s - loss: 1.0765 - accuracy: 0.5000
5/5 [==============================] - 0s 3ms/step - loss: 0.8718 - accuracy: 0.7292
5/5 [==============================] - 0s 33ms/step - loss: 0.8718 - accuracy: 0.7292 - val_loss: 1.2613 - val_accuracy: 0.0000e+00
Epoch 33/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8815 - accuracy: 0.7500
5/5 [==============================] - 0s 607us/step - loss: 0.8643 - accuracy: 0.7396
5/5 [==============================] - 0s 26ms/step - loss: 0.8643 - accuracy: 0.7396 - val_loss: 1.2473 - val_accuracy: 0.0000e+00
Epoch 34/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7963 - accuracy: 0.8000
5/5 [==============================] - 0s 849us/step - loss: 0.8573 - accuracy: 0.7604
5/5 [==============================] - 0s 27ms/step - loss: 0.8573 - accuracy: 0.7604 - val_loss: 1.2358 - val_accuracy: 0.0000e+00
Epoch 35/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7933 - accuracy: 0.8000
5/5 [==============================] - 0s 612us/step - loss: 0.8495 - accuracy: 0.7604
5/5 [==============================] - 0s 26ms/step - loss: 0.8495 - accuracy: 0.7604 - val_loss: 1.2218 - val_accuracy: 0.0000e+00
Epoch 36/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8034 - accuracy: 0.8000
5/5 [==============================] - 0s 3ms/step - loss: 0.8423 - accuracy: 0.7604
5/5 [==============================] - 0s 33ms/step - loss: 0.8423 - accuracy: 0.7604 - val_loss: 1.2092 - val_accuracy: 0.0000e+00
Epoch 37/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9345 - accuracy: 0.7000
5/5 [==============================] - 0s 2ms/step - loss: 0.8353 - accuracy: 0.7604
5/5 [==============================] - 0s 32ms/step - loss: 0.8353 - accuracy: 0.7604 - val_loss: 1.2018 - val_accuracy: 0.0000e+00
Epoch 38/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7590 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.8283 - accuracy: 0.7604
5/5 [==============================] - 0s 32ms/step - loss: 0.8283 - accuracy: 0.7604 - val_loss: 1.1932 - val_accuracy: 0.0000e+00
Epoch 39/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7568 - accuracy: 0.8500
5/5 [==============================] - 0s 3ms/step - loss: 0.8209 - accuracy: 0.7708
5/5 [==============================] - 0s 33ms/step - loss: 0.8209 - accuracy: 0.7708 - val_loss: 1.1809 - val_accuracy: 0.0000e+00
Epoch 40/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8633 - accuracy: 0.7500
5/5 [==============================] - 0s 523us/step - loss: 0.8134 - accuracy: 0.7812
5/5 [==============================] - 0s 27ms/step - loss: 0.8134 - accuracy: 0.7812 - val_loss: 1.1705 - val_accuracy: 0.0000e+00
Epoch 41/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8138 - accuracy: 0.7500
5/5 [==============================] - 0s 663us/step - loss: 0.8060 - accuracy: 0.7917
5/5 [==============================] - 0s 26ms/step - loss: 0.8060 - accuracy: 0.7917 - val_loss: 1.1600 - val_accuracy: 0.0000e+00
Epoch 42/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8629 - accuracy: 0.7000
5/5 [==============================] - 0s 3ms/step - loss: 0.7989 - accuracy: 0.7917
5/5 [==============================] - 0s 35ms/step - loss: 0.7989 - accuracy: 0.7917 - val_loss: 1.1503 - val_accuracy: 0.0000e+00
Epoch 43/200
1/5 [=====>........................] - ETA: 0s - loss: 0.9243 - accuracy: 0.7000
5/5 [==============================] - 0s 2ms/step - loss: 0.7914 - accuracy: 0.7917
5/5 [==============================] - 0s 31ms/step - loss: 0.7914 - accuracy: 0.7917 - val_loss: 1.1406 - val_accuracy: 0.0000e+00
Epoch 44/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7645 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.7841 - accuracy: 0.7917
5/5 [==============================] - 0s 33ms/step - loss: 0.7841 - accuracy: 0.7917 - val_loss: 1.1321 - val_accuracy: 0.0000e+00
Epoch 45/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7493 - accuracy: 0.8000
5/5 [==============================] - 0s 2ms/step - loss: 0.7766 - accuracy: 0.7917
5/5 [==============================] - 0s 32ms/step - loss: 0.7766 - accuracy: 0.7917 - val_loss: 1.1219 - val_accuracy: 0.0000e+00
Epoch 46/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8219 - accuracy: 0.7000
5/5 [==============================] - 0s 645us/step - loss: 0.7690 - accuracy: 0.7917
5/5 [==============================] - 0s 27ms/step - loss: 0.7690 - accuracy: 0.7917 - val_loss: 1.1113 - val_accuracy: 0.0000e+00
Epoch 47/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7436 - accuracy: 0.7500
5/5 [==============================] - 0s 524us/step - loss: 0.7616 - accuracy: 0.7917
5/5 [==============================] - 0s 26ms/step - loss: 0.7616 - accuracy: 0.7917 - val_loss: 1.1004 - val_accuracy: 0.0000e+00
Epoch 48/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8330 - accuracy: 0.6500
5/5 [==============================] - 0s 2ms/step - loss: 0.7543 - accuracy: 0.7917
5/5 [==============================] - 0s 32ms/step - loss: 0.7543 - accuracy: 0.7917 - val_loss: 1.0938 - val_accuracy: 0.0000e+00
Epoch 49/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7690 - accuracy: 0.8500
5/5 [==============================] - 0s 3ms/step - loss: 0.7469 - accuracy: 0.7917
5/5 [==============================] - 0s 33ms/step - loss: 0.7469 - accuracy: 0.7917 - val_loss: 1.0851 - val_accuracy: 0.0000e+00
Epoch 50/200
1/5 [=====>........................] - ETA: 0s - loss: 0.8127 - accuracy: 0.7500
5/5 [==============================] - 0s 3ms/step - loss: 0.7395 - accuracy: 0.7917
5/5 [==============================] - 0s 34ms/step - loss: 0.7395 - accuracy: 0.7917 - val_loss: 1.0767 - val_accuracy: 0.0000e+00
Epoch 51/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7547 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.7322 - accuracy: 0.7917
5/5 [==============================] - 0s 31ms/step - loss: 0.7322 - accuracy: 0.7917 - val_loss: 1.0657 - val_accuracy: 0.0000e+00
Epoch 52/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7456 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.7248 - accuracy: 0.7917
5/5 [==============================] - 0s 29ms/step - loss: 0.7248 - accuracy: 0.7917 - val_loss: 1.0564 - val_accuracy: 0.0000e+00
Epoch 53/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6830 - accuracy: 0.8000
5/5 [==============================] - 0s 606us/step - loss: 0.7176 - accuracy: 0.7917
5/5 [==============================] - 0s 26ms/step - loss: 0.7176 - accuracy: 0.7917 - val_loss: 1.0487 - val_accuracy: 0.0000e+00
Epoch 54/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6858 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.7105 - accuracy: 0.7917
5/5 [==============================] - 0s 31ms/step - loss: 0.7105 - accuracy: 0.7917 - val_loss: 1.0416 - val_accuracy: 0.0000e+00
Epoch 55/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7632 - accuracy: 0.7000
5/5 [==============================] - 0s 2ms/step - loss: 0.7038 - accuracy: 0.7917
5/5 [==============================] - 0s 32ms/step - loss: 0.7038 - accuracy: 0.7917 - val_loss: 1.0348 - val_accuracy: 0.0000e+00
Epoch 56/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7497 - accuracy: 0.7500
5/5 [==============================] - 0s 3ms/step - loss: 0.6965 - accuracy: 0.7917
5/5 [==============================] - 0s 68ms/step - loss: 0.6965 - accuracy: 0.7917 - val_loss: 1.0289 - val_accuracy: 0.0000e+00
Epoch 57/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7487 - accuracy: 0.6500
5/5 [==============================] - 0s 3ms/step - loss: 0.6898 - accuracy: 0.7917
5/5 [==============================] - 0s 33ms/step - loss: 0.6898 - accuracy: 0.7917 - val_loss: 1.0226 - val_accuracy: 0.0000e+00
Epoch 58/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7547 - accuracy: 0.8000
5/5 [==============================] - 0s 608us/step - loss: 0.6828 - accuracy: 0.7917
5/5 [==============================] - 0s 26ms/step - loss: 0.6828 - accuracy: 0.7917 - val_loss: 1.0144 - val_accuracy: 0.0000e+00
Epoch 59/200
1/5 [=====>........................] - ETA: 0s - loss: 0.7410 - accuracy: 0.7000
5/5 [==============================] - 0s 655us/step - loss: 0.6758 - accuracy: 0.7917
5/5 [==============================] - 0s 27ms/step - loss: 0.6758 - accuracy: 0.7917 - val_loss: 1.0091 - val_accuracy: 0.0000e+00
Epoch 60/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6408 - accuracy: 0.8000
5/5 [==============================] - 0s 2ms/step - loss: 0.6692 - accuracy: 0.7917
5/5 [==============================] - 0s 31ms/step - loss: 0.6692 - accuracy: 0.7917 - val_loss: 1.0021 - val_accuracy: 0.0000e+00
Epoch 61/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6549 - accuracy: 0.8000
5/5 [==============================] - 0s 2ms/step - loss: 0.6626 - accuracy: 0.7917
5/5 [==============================] - 0s 31ms/step - loss: 0.6626 - accuracy: 0.7917 - val_loss: 0.9957 - val_accuracy: 0.0000e+00
Epoch 62/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6856 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.6559 - accuracy: 0.7917
5/5 [==============================] - 0s 32ms/step - loss: 0.6559 - accuracy: 0.7917 - val_loss: 0.9879 - val_accuracy: 0.0000e+00
Epoch 63/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6367 - accuracy: 0.8500
5/5 [==============================] - 0s 1ms/step - loss: 0.6494 - accuracy: 0.7917
5/5 [==============================] - 0s 30ms/step - loss: 0.6494 - accuracy: 0.7917 - val_loss: 0.9811 - val_accuracy: 0.0000e+00
Epoch 64/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6529 - accuracy: 0.7000
5/5 [==============================] - 0s 613us/step - loss: 0.6425 - accuracy: 0.7917
5/5 [==============================] - 0s 26ms/step - loss: 0.6425 - accuracy: 0.7917 - val_loss: 0.9743 - val_accuracy: 0.0000e+00
Epoch 65/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6007 - accuracy: 0.8500
5/5 [==============================] - 0s 663us/step - loss: 0.6362 - accuracy: 0.7917
5/5 [==============================] - 0s 26ms/step - loss: 0.6362 - accuracy: 0.7917 - val_loss: 0.9675 - val_accuracy: 0.0000e+00
Epoch 66/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5578 - accuracy: 0.7500
5/5 [==============================] - 0s 3ms/step - loss: 0.6293 - accuracy: 0.7917
5/5 [==============================] - 0s 32ms/step - loss: 0.6293 - accuracy: 0.7917 - val_loss: 0.9620 - val_accuracy: 0.0000e+00
Epoch 67/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6102 - accuracy: 0.8000
5/5 [==============================] - 0s 2ms/step - loss: 0.6233 - accuracy: 0.7812
5/5 [==============================] - 0s 32ms/step - loss: 0.6233 - accuracy: 0.7812 - val_loss: 0.9557 - val_accuracy: 0.0000e+00
Epoch 68/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5422 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.6168 - accuracy: 0.7812
5/5 [==============================] - 0s 33ms/step - loss: 0.6168 - accuracy: 0.7812 - val_loss: 0.9473 - val_accuracy: 0.0000e+00
Epoch 69/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6157 - accuracy: 0.9500
5/5 [==============================] - 0s 3ms/step - loss: 0.6104 - accuracy: 0.7812
5/5 [==============================] - 0s 33ms/step - loss: 0.6104 - accuracy: 0.7812 - val_loss: 0.9386 - val_accuracy: 0.0000e+00
Epoch 70/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6297 - accuracy: 0.8500
5/5 [==============================] - 0s 3ms/step - loss: 0.6038 - accuracy: 0.7812
5/5 [==============================] - 0s 33ms/step - loss: 0.6038 - accuracy: 0.7812 - val_loss: 0.9315 - val_accuracy: 0.0000e+00
Epoch 71/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5232 - accuracy: 0.9000
5/5 [==============================] - 0s 551us/step - loss: 0.5976 - accuracy: 0.7812
5/5 [==============================] - 0s 26ms/step - loss: 0.5976 - accuracy: 0.7812 - val_loss: 0.9239 - val_accuracy: 0.0000e+00
Epoch 72/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5390 - accuracy: 0.8500
5/5 [==============================] - 0s 557us/step - loss: 0.5914 - accuracy: 0.7812
5/5 [==============================] - 0s 26ms/step - loss: 0.5914 - accuracy: 0.7812 - val_loss: 0.9178 - val_accuracy: 0.0000e+00
Epoch 73/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4926 - accuracy: 0.9000
5/5 [==============================] - 0s 3ms/step - loss: 0.5850 - accuracy: 0.8125
5/5 [==============================] - 0s 31ms/step - loss: 0.5850 - accuracy: 0.8125 - val_loss: 0.9114 - val_accuracy: 0.1200
Epoch 74/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5390 - accuracy: 0.8000
5/5 [==============================] - 0s 2ms/step - loss: 0.5788 - accuracy: 0.8125
5/5 [==============================] - 0s 32ms/step - loss: 0.5788 - accuracy: 0.8125 - val_loss: 0.9038 - val_accuracy: 0.3600
Epoch 75/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5202 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.5724 - accuracy: 0.8333
5/5 [==============================] - 0s 31ms/step - loss: 0.5724 - accuracy: 0.8333 - val_loss: 0.8982 - val_accuracy: 0.4000
Epoch 76/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5584 - accuracy: 0.7500
5/5 [==============================] - 0s 2ms/step - loss: 0.5663 - accuracy: 0.8646
5/5 [==============================] - 0s 32ms/step - loss: 0.5663 - accuracy: 0.8646 - val_loss: 0.8926 - val_accuracy: 0.4000
Epoch 77/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5535 - accuracy: 0.8500
5/5 [==============================] - 0s 626us/step - loss: 0.5601 - accuracy: 0.8646
5/5 [==============================] - 0s 27ms/step - loss: 0.5601 - accuracy: 0.8646 - val_loss: 0.8847 - val_accuracy: 0.4400
Epoch 78/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6309 - accuracy: 0.8500
5/5 [==============================] - 0s 594us/step - loss: 0.5539 - accuracy: 0.8646
5/5 [==============================] - 0s 26ms/step - loss: 0.5539 - accuracy: 0.8646 - val_loss: 0.8753 - val_accuracy: 0.4400
Epoch 79/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6024 - accuracy: 0.7500
5/5 [==============================] - 0s 537us/step - loss: 0.5477 - accuracy: 0.8646
5/5 [==============================] - 0s 27ms/step - loss: 0.5477 - accuracy: 0.8646 - val_loss: 0.8672 - val_accuracy: 0.4400
Epoch 80/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5014 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.5422 - accuracy: 0.8646
5/5 [==============================] - 0s 31ms/step - loss: 0.5422 - accuracy: 0.8646 - val_loss: 0.8594 - val_accuracy: 0.4400
Epoch 81/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6606 - accuracy: 0.7000
5/5 [==============================] - 0s 3ms/step - loss: 0.5361 - accuracy: 0.8646
5/5 [==============================] - 0s 33ms/step - loss: 0.5361 - accuracy: 0.8646 - val_loss: 0.8531 - val_accuracy: 0.4400
Epoch 82/200
1/5 [=====>........................] - ETA: 0s - loss: 0.6058 - accuracy: 0.7500
5/5 [==============================] - 0s 1ms/step - loss: 0.5302 - accuracy: 0.8750
5/5 [==============================] - 0s 31ms/step - loss: 0.5302 - accuracy: 0.8750 - val_loss: 0.8477 - val_accuracy: 0.4800
Epoch 83/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5446 - accuracy: 0.8000
5/5 [==============================] - 0s 1ms/step - loss: 0.5243 - accuracy: 0.8750
5/5 [==============================] - 0s 30ms/step - loss: 0.5243 - accuracy: 0.8750 - val_loss: 0.8401 - val_accuracy: 0.5200
Epoch 84/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5798 - accuracy: 0.8500
5/5 [==============================] - 0s 634us/step - loss: 0.5187 - accuracy: 0.8750
5/5 [==============================] - 0s 26ms/step - loss: 0.5187 - accuracy: 0.8750 - val_loss: 0.8311 - val_accuracy: 0.5200
Epoch 85/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4894 - accuracy: 0.9500
5/5 [==============================] - 0s 619us/step - loss: 0.5131 - accuracy: 0.8750
5/5 [==============================] - 0s 26ms/step - loss: 0.5131 - accuracy: 0.8750 - val_loss: 0.8218 - val_accuracy: 0.5200
Epoch 86/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5637 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.5075 - accuracy: 0.8750
5/5 [==============================] - 0s 32ms/step - loss: 0.5075 - accuracy: 0.8750 - val_loss: 0.8147 - val_accuracy: 0.5200
Epoch 87/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5724 - accuracy: 0.8000
5/5 [==============================] - 0s 2ms/step - loss: 0.5017 - accuracy: 0.8750
5/5 [==============================] - 0s 32ms/step - loss: 0.5017 - accuracy: 0.8750 - val_loss: 0.8067 - val_accuracy: 0.5200
Epoch 88/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4510 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.4963 - accuracy: 0.8750
5/5 [==============================] - 0s 33ms/step - loss: 0.4963 - accuracy: 0.8750 - val_loss: 0.7977 - val_accuracy: 0.5600
Epoch 89/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4442 - accuracy: 0.9000
5/5 [==============================] - 0s 632us/step - loss: 0.4905 - accuracy: 0.8750
5/5 [==============================] - 0s 26ms/step - loss: 0.4905 - accuracy: 0.8750 - val_loss: 0.7886 - val_accuracy: 0.5600
Epoch 90/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5058 - accuracy: 0.7500
5/5 [==============================] - 0s 3ms/step - loss: 0.4854 - accuracy: 0.8854
5/5 [==============================] - 0s 32ms/step - loss: 0.4854 - accuracy: 0.8854 - val_loss: 0.7831 - val_accuracy: 0.5600
Epoch 91/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4314 - accuracy: 0.9500
5/5 [==============================] - 0s 565us/step - loss: 0.4799 - accuracy: 0.8854
5/5 [==============================] - 0s 26ms/step - loss: 0.4799 - accuracy: 0.8854 - val_loss: 0.7738 - val_accuracy: 0.5600
Epoch 92/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4514 - accuracy: 0.9000
5/5 [==============================] - 0s 628us/step - loss: 0.4746 - accuracy: 0.8958
5/5 [==============================] - 0s 26ms/step - loss: 0.4746 - accuracy: 0.8958 - val_loss: 0.7651 - val_accuracy: 0.6000
Epoch 93/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4436 - accuracy: 0.9000
5/5 [==============================] - 0s 605us/step - loss: 0.4696 - accuracy: 0.8958
5/5 [==============================] - 0s 26ms/step - loss: 0.4696 - accuracy: 0.8958 - val_loss: 0.7561 - val_accuracy: 0.6400
Epoch 94/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4046 - accuracy: 0.9000
5/5 [==============================] - 0s 555us/step - loss: 0.4646 - accuracy: 0.8958
5/5 [==============================] - 0s 26ms/step - loss: 0.4646 - accuracy: 0.8958 - val_loss: 0.7493 - val_accuracy: 0.6400
Epoch 95/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3983 - accuracy: 0.9000
5/5 [==============================] - 0s 611us/step - loss: 0.4597 - accuracy: 0.8958
5/5 [==============================] - 0s 27ms/step - loss: 0.4597 - accuracy: 0.8958 - val_loss: 0.7436 - val_accuracy: 0.6400
Epoch 96/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4426 - accuracy: 0.9500
5/5 [==============================] - 0s 630us/step - loss: 0.4552 - accuracy: 0.8958
5/5 [==============================] - 0s 26ms/step - loss: 0.4552 - accuracy: 0.8958 - val_loss: 0.7362 - val_accuracy: 0.6400
Epoch 97/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4589 - accuracy: 0.8000
5/5 [==============================] - 0s 611us/step - loss: 0.4502 - accuracy: 0.8958
5/5 [==============================] - 0s 26ms/step - loss: 0.4502 - accuracy: 0.8958 - val_loss: 0.7322 - val_accuracy: 0.6400
Epoch 98/200
1/5 [=====>........................] - ETA: 0s - loss: 0.5474 - accuracy: 0.8500
5/5 [==============================] - 0s 617us/step - loss: 0.4457 - accuracy: 0.8958
5/5 [==============================] - 0s 27ms/step - loss: 0.4457 - accuracy: 0.8958 - val_loss: 0.7259 - val_accuracy: 0.6400
Epoch 99/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4587 - accuracy: 0.8500
5/5 [==============================] - 0s 618us/step - loss: 0.4410 - accuracy: 0.8958
5/5 [==============================] - 0s 26ms/step - loss: 0.4410 - accuracy: 0.8958 - val_loss: 0.7210 - val_accuracy: 0.6400
Epoch 100/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3504 - accuracy: 0.9000
5/5 [==============================] - 0s 627us/step - loss: 0.4370 - accuracy: 0.8958
5/5 [==============================] - 0s 27ms/step - loss: 0.4370 - accuracy: 0.8958 - val_loss: 0.7146 - val_accuracy: 0.6400
Epoch 101/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3194 - accuracy: 1.0000
5/5 [==============================] - 0s 2ms/step - loss: 0.4322 - accuracy: 0.8958
5/5 [==============================] - 0s 31ms/step - loss: 0.4322 - accuracy: 0.8958 - val_loss: 0.7067 - val_accuracy: 0.6400
Epoch 102/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4717 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.4277 - accuracy: 0.8958
5/5 [==============================] - 0s 30ms/step - loss: 0.4277 - accuracy: 0.8958 - val_loss: 0.6990 - val_accuracy: 0.6400
Epoch 103/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4912 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.4235 - accuracy: 0.8854
5/5 [==============================] - 0s 33ms/step - loss: 0.4235 - accuracy: 0.8854 - val_loss: 0.6945 - val_accuracy: 0.6400
Epoch 104/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4160 - accuracy: 0.9500
5/5 [==============================] - 0s 632us/step - loss: 0.4189 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.4189 - accuracy: 0.9062 - val_loss: 0.6884 - val_accuracy: 0.6400
Epoch 105/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4485 - accuracy: 0.9000
5/5 [==============================] - 0s 531us/step - loss: 0.4149 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.4149 - accuracy: 0.9062 - val_loss: 0.6838 - val_accuracy: 0.6400
Epoch 106/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4458 - accuracy: 0.9000
5/5 [==============================] - 0s 794us/step - loss: 0.4107 - accuracy: 0.9167
5/5 [==============================] - 0s 28ms/step - loss: 0.4107 - accuracy: 0.9167 - val_loss: 0.6801 - val_accuracy: 0.6400
Epoch 107/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3733 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.4069 - accuracy: 0.9062
5/5 [==============================] - 0s 30ms/step - loss: 0.4069 - accuracy: 0.9062 - val_loss: 0.6755 - val_accuracy: 0.6400
Epoch 108/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4710 - accuracy: 0.8500
5/5 [==============================] - 0s 1ms/step - loss: 0.4025 - accuracy: 0.9062
5/5 [==============================] - 0s 31ms/step - loss: 0.4025 - accuracy: 0.9062 - val_loss: 0.6685 - val_accuracy: 0.6400
Epoch 109/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3530 - accuracy: 1.0000
5/5 [==============================] - 0s 3ms/step - loss: 0.3987 - accuracy: 0.9062
5/5 [==============================] - 0s 32ms/step - loss: 0.3987 - accuracy: 0.9062 - val_loss: 0.6603 - val_accuracy: 0.6400
Epoch 110/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3945 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.3946 - accuracy: 0.9062
5/5 [==============================] - 0s 29ms/step - loss: 0.3946 - accuracy: 0.9062 - val_loss: 0.6558 - val_accuracy: 0.6400
Epoch 111/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3937 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.3907 - accuracy: 0.9062
5/5 [==============================] - 0s 28ms/step - loss: 0.3907 - accuracy: 0.9062 - val_loss: 0.6508 - val_accuracy: 0.6400
Epoch 112/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3172 - accuracy: 0.9000
5/5 [==============================] - 0s 571us/step - loss: 0.3869 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3869 - accuracy: 0.9062 - val_loss: 0.6435 - val_accuracy: 0.6400
Epoch 113/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4204 - accuracy: 0.9000
5/5 [==============================] - 0s 537us/step - loss: 0.3834 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3834 - accuracy: 0.9062 - val_loss: 0.6407 - val_accuracy: 0.6400
Epoch 114/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3559 - accuracy: 0.9500
5/5 [==============================] - 0s 3ms/step - loss: 0.3807 - accuracy: 0.9062
5/5 [==============================] - 0s 34ms/step - loss: 0.3807 - accuracy: 0.9062 - val_loss: 0.6431 - val_accuracy: 0.6400
Epoch 115/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3245 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.3765 - accuracy: 0.9062
5/5 [==============================] - 0s 31ms/step - loss: 0.3765 - accuracy: 0.9062 - val_loss: 0.6409 - val_accuracy: 0.6400
Epoch 116/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3550 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.3729 - accuracy: 0.9062
5/5 [==============================] - 0s 31ms/step - loss: 0.3729 - accuracy: 0.9062 - val_loss: 0.6369 - val_accuracy: 0.6400
Epoch 117/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3448 - accuracy: 1.0000
5/5 [==============================] - 0s 649us/step - loss: 0.3697 - accuracy: 0.9062
5/5 [==============================] - 0s 28ms/step - loss: 0.3697 - accuracy: 0.9062 - val_loss: 0.6300 - val_accuracy: 0.6400
Epoch 118/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3611 - accuracy: 0.8500
5/5 [==============================] - 0s 649us/step - loss: 0.3664 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3664 - accuracy: 0.9062 - val_loss: 0.6276 - val_accuracy: 0.6400
Epoch 119/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3513 - accuracy: 0.9500
5/5 [==============================] - 0s 582us/step - loss: 0.3634 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3634 - accuracy: 0.9062 - val_loss: 0.6221 - val_accuracy: 0.6400
Epoch 120/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4132 - accuracy: 0.8000
5/5 [==============================] - 0s 1ms/step - loss: 0.3607 - accuracy: 0.9062
5/5 [==============================] - 0s 30ms/step - loss: 0.3607 - accuracy: 0.9062 - val_loss: 0.6159 - val_accuracy: 0.6400
Epoch 121/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3394 - accuracy: 0.9000
5/5 [==============================] - 0s 552us/step - loss: 0.3571 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3571 - accuracy: 0.9062 - val_loss: 0.6110 - val_accuracy: 0.6400
Epoch 122/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2415 - accuracy: 0.9500
5/5 [==============================] - 0s 628us/step - loss: 0.3550 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3550 - accuracy: 0.9062 - val_loss: 0.6072 - val_accuracy: 0.6400
Epoch 123/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3936 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.3514 - accuracy: 0.9062
5/5 [==============================] - 0s 33ms/step - loss: 0.3514 - accuracy: 0.9062 - val_loss: 0.6065 - val_accuracy: 0.6400
Epoch 124/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4507 - accuracy: 0.8500
5/5 [==============================] - 0s 1ms/step - loss: 0.3487 - accuracy: 0.9062
5/5 [==============================] - 0s 29ms/step - loss: 0.3487 - accuracy: 0.9062 - val_loss: 0.6042 - val_accuracy: 0.6800
Epoch 125/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3833 - accuracy: 0.8500
5/5 [==============================] - 0s 605us/step - loss: 0.3459 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3459 - accuracy: 0.9062 - val_loss: 0.6021 - val_accuracy: 0.6800
Epoch 126/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3303 - accuracy: 0.8500
5/5 [==============================] - 0s 1ms/step - loss: 0.3431 - accuracy: 0.9062
5/5 [==============================] - 0s 27ms/step - loss: 0.3431 - accuracy: 0.9062 - val_loss: 0.5988 - val_accuracy: 0.6800
Epoch 127/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2951 - accuracy: 0.9500
5/5 [==============================] - 0s 635us/step - loss: 0.3406 - accuracy: 0.9062
5/5 [==============================] - 0s 27ms/step - loss: 0.3406 - accuracy: 0.9062 - val_loss: 0.5936 - val_accuracy: 0.6800
Epoch 128/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3692 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.3374 - accuracy: 0.9062
5/5 [==============================] - 0s 29ms/step - loss: 0.3374 - accuracy: 0.9062 - val_loss: 0.5912 - val_accuracy: 0.6800
Epoch 129/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3332 - accuracy: 1.0000
5/5 [==============================] - 0s 2ms/step - loss: 0.3351 - accuracy: 0.9062
5/5 [==============================] - 0s 33ms/step - loss: 0.3351 - accuracy: 0.9062 - val_loss: 0.5888 - val_accuracy: 0.6800
Epoch 130/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3401 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.3322 - accuracy: 0.9062
5/5 [==============================] - 0s 30ms/step - loss: 0.3322 - accuracy: 0.9062 - val_loss: 0.5854 - val_accuracy: 0.6800
Epoch 131/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2288 - accuracy: 0.9000
5/5 [==============================] - 0s 784us/step - loss: 0.3294 - accuracy: 0.9062
5/5 [==============================] - 0s 28ms/step - loss: 0.3294 - accuracy: 0.9062 - val_loss: 0.5822 - val_accuracy: 0.6800
Epoch 132/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3352 - accuracy: 0.9500
5/5 [==============================] - 0s 616us/step - loss: 0.3269 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3269 - accuracy: 0.9062 - val_loss: 0.5779 - val_accuracy: 0.6800
Epoch 133/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3572 - accuracy: 0.9000
5/5 [==============================] - 0s 588us/step - loss: 0.3242 - accuracy: 0.9062
5/5 [==============================] - 0s 26ms/step - loss: 0.3242 - accuracy: 0.9062 - val_loss: 0.5736 - val_accuracy: 0.6800
Epoch 134/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3048 - accuracy: 0.8500
5/5 [==============================] - 0s 3ms/step - loss: 0.3220 - accuracy: 0.9167
5/5 [==============================] - 0s 34ms/step - loss: 0.3220 - accuracy: 0.9167 - val_loss: 0.5694 - val_accuracy: 0.7200
Epoch 135/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3022 - accuracy: 0.9500
5/5 [==============================] - 0s 3ms/step - loss: 0.3196 - accuracy: 0.9167
5/5 [==============================] - 0s 33ms/step - loss: 0.3196 - accuracy: 0.9167 - val_loss: 0.5636 - val_accuracy: 0.7200
Epoch 136/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2346 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.3169 - accuracy: 0.9167
5/5 [==============================] - 0s 30ms/step - loss: 0.3169 - accuracy: 0.9167 - val_loss: 0.5574 - val_accuracy: 0.7200
Epoch 137/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3432 - accuracy: 0.9000
5/5 [==============================] - 0s 3ms/step - loss: 0.3146 - accuracy: 0.9167
5/5 [==============================] - 0s 35ms/step - loss: 0.3146 - accuracy: 0.9167 - val_loss: 0.5529 - val_accuracy: 0.7600
Epoch 138/200
1/5 [=====>........................] - ETA: 0s - loss: 0.4000 - accuracy: 0.9000
5/5 [==============================] - 0s 3ms/step - loss: 0.3123 - accuracy: 0.9167
5/5 [==============================] - 0s 32ms/step - loss: 0.3123 - accuracy: 0.9167 - val_loss: 0.5504 - val_accuracy: 0.7600
Epoch 139/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3690 - accuracy: 0.8000
5/5 [==============================] - 0s 606us/step - loss: 0.3106 - accuracy: 0.9167
5/5 [==============================] - 0s 26ms/step - loss: 0.3106 - accuracy: 0.9167 - val_loss: 0.5493 - val_accuracy: 0.7600
Epoch 140/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2240 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.3079 - accuracy: 0.9167
5/5 [==============================] - 0s 32ms/step - loss: 0.3079 - accuracy: 0.9167 - val_loss: 0.5444 - val_accuracy: 0.7600
Epoch 141/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2609 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.3058 - accuracy: 0.9271
5/5 [==============================] - 0s 31ms/step - loss: 0.3058 - accuracy: 0.9271 - val_loss: 0.5440 - val_accuracy: 0.7600
Epoch 142/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2301 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.3039 - accuracy: 0.9167
5/5 [==============================] - 0s 31ms/step - loss: 0.3039 - accuracy: 0.9167 - val_loss: 0.5399 - val_accuracy: 0.7600
Epoch 143/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2970 - accuracy: 1.0000
5/5 [==============================] - 0s 924us/step - loss: 0.3015 - accuracy: 0.9271
5/5 [==============================] - 0s 30ms/step - loss: 0.3015 - accuracy: 0.9271 - val_loss: 0.5362 - val_accuracy: 0.8000
Epoch 144/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2397 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.2992 - accuracy: 0.9271
5/5 [==============================] - 0s 31ms/step - loss: 0.2992 - accuracy: 0.9271 - val_loss: 0.5318 - val_accuracy: 0.8000
Epoch 145/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2133 - accuracy: 0.9500
5/5 [==============================] - 0s 649us/step - loss: 0.2973 - accuracy: 0.9375
5/5 [==============================] - 0s 26ms/step - loss: 0.2973 - accuracy: 0.9375 - val_loss: 0.5313 - val_accuracy: 0.8000
Epoch 146/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3304 - accuracy: 0.8500
5/5 [==============================] - 0s 610us/step - loss: 0.2948 - accuracy: 0.9375
5/5 [==============================] - 0s 28ms/step - loss: 0.2948 - accuracy: 0.9375 - val_loss: 0.5286 - val_accuracy: 0.8000
Epoch 147/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1925 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.2933 - accuracy: 0.9375
5/5 [==============================] - 0s 30ms/step - loss: 0.2933 - accuracy: 0.9375 - val_loss: 0.5279 - val_accuracy: 0.8000
Epoch 148/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2841 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.2906 - accuracy: 0.9375
5/5 [==============================] - 0s 62ms/step - loss: 0.2906 - accuracy: 0.9375 - val_loss: 0.5264 - val_accuracy: 0.8000
Epoch 149/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1974 - accuracy: 1.0000
5/5 [==============================] - 0s 2ms/step - loss: 0.2891 - accuracy: 0.9375
5/5 [==============================] - 0s 31ms/step - loss: 0.2891 - accuracy: 0.9375 - val_loss: 0.5256 - val_accuracy: 0.8000
Epoch 150/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1827 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.2866 - accuracy: 0.9375
5/5 [==============================] - 0s 30ms/step - loss: 0.2866 - accuracy: 0.9375 - val_loss: 0.5201 - val_accuracy: 0.8000
Epoch 151/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1956 - accuracy: 1.0000
5/5 [==============================] - 0s 634us/step - loss: 0.2849 - accuracy: 0.9375
5/5 [==============================] - 0s 26ms/step - loss: 0.2849 - accuracy: 0.9375 - val_loss: 0.5148 - val_accuracy: 0.8000
Epoch 152/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2623 - accuracy: 0.9500
5/5 [==============================] - 0s 592us/step - loss: 0.2828 - accuracy: 0.9375
5/5 [==============================] - 0s 26ms/step - loss: 0.2828 - accuracy: 0.9375 - val_loss: 0.5116 - val_accuracy: 0.8000
Epoch 153/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3153 - accuracy: 0.9000
5/5 [==============================] - 0s 994us/step - loss: 0.2807 - accuracy: 0.9375
5/5 [==============================] - 0s 30ms/step - loss: 0.2807 - accuracy: 0.9375 - val_loss: 0.5087 - val_accuracy: 0.8000
Epoch 154/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1895 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.2786 - accuracy: 0.9375
5/5 [==============================] - 0s 32ms/step - loss: 0.2786 - accuracy: 0.9375 - val_loss: 0.5035 - val_accuracy: 0.8000
Epoch 155/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2475 - accuracy: 0.9500
5/5 [==============================] - 0s 2ms/step - loss: 0.2764 - accuracy: 0.9479
5/5 [==============================] - 0s 33ms/step - loss: 0.2764 - accuracy: 0.9479 - val_loss: 0.4989 - val_accuracy: 0.8000
Epoch 156/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1431 - accuracy: 1.0000
5/5 [==============================] - 0s 2ms/step - loss: 0.2747 - accuracy: 0.9479
5/5 [==============================] - 0s 34ms/step - loss: 0.2747 - accuracy: 0.9479 - val_loss: 0.4969 - val_accuracy: 0.8000
Epoch 157/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2316 - accuracy: 0.9500
5/5 [==============================] - 0s 625us/step - loss: 0.2724 - accuracy: 0.9479
5/5 [==============================] - 0s 26ms/step - loss: 0.2724 - accuracy: 0.9479 - val_loss: 0.4940 - val_accuracy: 0.8000
Epoch 158/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3008 - accuracy: 0.9500
5/5 [==============================] - 0s 611us/step - loss: 0.2707 - accuracy: 0.9479
5/5 [==============================] - 0s 27ms/step - loss: 0.2707 - accuracy: 0.9479 - val_loss: 0.4938 - val_accuracy: 0.8000
Epoch 159/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2216 - accuracy: 0.9500
5/5 [==============================] - 0s 737us/step - loss: 0.2689 - accuracy: 0.9375
5/5 [==============================] - 0s 28ms/step - loss: 0.2689 - accuracy: 0.9375 - val_loss: 0.4888 - val_accuracy: 0.8400
Epoch 160/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3343 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.2668 - accuracy: 0.9479
5/5 [==============================] - 0s 31ms/step - loss: 0.2668 - accuracy: 0.9479 - val_loss: 0.4877 - val_accuracy: 0.8400
Epoch 161/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3573 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.2650 - accuracy: 0.9479
5/5 [==============================] - 0s 30ms/step - loss: 0.2650 - accuracy: 0.9479 - val_loss: 0.4859 - val_accuracy: 0.8400
Epoch 162/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2741 - accuracy: 1.0000
5/5 [==============================] - 0s 849us/step - loss: 0.2634 - accuracy: 0.9375
5/5 [==============================] - 0s 28ms/step - loss: 0.2634 - accuracy: 0.9375 - val_loss: 0.4803 - val_accuracy: 0.8400
Epoch 163/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2887 - accuracy: 0.9500
5/5 [==============================] - 0s 2ms/step - loss: 0.2614 - accuracy: 0.9479
5/5 [==============================] - 0s 32ms/step - loss: 0.2614 - accuracy: 0.9479 - val_loss: 0.4774 - val_accuracy: 0.8400
Epoch 164/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1815 - accuracy: 1.0000
5/5 [==============================] - 0s 585us/step - loss: 0.2593 - accuracy: 0.9479
5/5 [==============================] - 0s 26ms/step - loss: 0.2593 - accuracy: 0.9479 - val_loss: 0.4731 - val_accuracy: 0.8400
Epoch 165/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3202 - accuracy: 0.9000
5/5 [==============================] - 0s 659us/step - loss: 0.2576 - accuracy: 0.9479
5/5 [==============================] - 0s 27ms/step - loss: 0.2576 - accuracy: 0.9479 - val_loss: 0.4721 - val_accuracy: 0.8400
Epoch 166/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3690 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.2554 - accuracy: 0.9479
5/5 [==============================] - 0s 32ms/step - loss: 0.2554 - accuracy: 0.9479 - val_loss: 0.4685 - val_accuracy: 0.8800
Epoch 167/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2891 - accuracy: 0.9500
5/5 [==============================] - 0s 535us/step - loss: 0.2540 - accuracy: 0.9479
5/5 [==============================] - 0s 26ms/step - loss: 0.2540 - accuracy: 0.9479 - val_loss: 0.4702 - val_accuracy: 0.8800
Epoch 168/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2278 - accuracy: 1.0000
5/5 [==============================] - 0s 624us/step - loss: 0.2520 - accuracy: 0.9479
5/5 [==============================] - 0s 26ms/step - loss: 0.2520 - accuracy: 0.9479 - val_loss: 0.4678 - val_accuracy: 0.8800
Epoch 169/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2974 - accuracy: 0.8500
5/5 [==============================] - 0s 3ms/step - loss: 0.2502 - accuracy: 0.9479
5/5 [==============================] - 0s 32ms/step - loss: 0.2502 - accuracy: 0.9479 - val_loss: 0.4630 - val_accuracy: 0.8800
Epoch 170/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3433 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.2481 - accuracy: 0.9479
5/5 [==============================] - 0s 31ms/step - loss: 0.2481 - accuracy: 0.9479 - val_loss: 0.4595 - val_accuracy: 0.8800
Epoch 171/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2853 - accuracy: 0.9500
5/5 [==============================] - 0s 532us/step - loss: 0.2462 - accuracy: 0.9479
5/5 [==============================] - 0s 26ms/step - loss: 0.2462 - accuracy: 0.9479 - val_loss: 0.4594 - val_accuracy: 0.8800
Epoch 172/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2316 - accuracy: 1.0000
5/5 [==============================] - 0s 672us/step - loss: 0.2443 - accuracy: 0.9479
5/5 [==============================] - 0s 26ms/step - loss: 0.2443 - accuracy: 0.9479 - val_loss: 0.4565 - val_accuracy: 0.8800
Epoch 173/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2700 - accuracy: 0.9500
5/5 [==============================] - 0s 2ms/step - loss: 0.2432 - accuracy: 0.9583
5/5 [==============================] - 0s 31ms/step - loss: 0.2432 - accuracy: 0.9583 - val_loss: 0.4547 - val_accuracy: 0.8800
Epoch 174/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3305 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.2408 - accuracy: 0.9479
5/5 [==============================] - 0s 30ms/step - loss: 0.2408 - accuracy: 0.9479 - val_loss: 0.4517 - val_accuracy: 0.8800
Epoch 175/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2469 - accuracy: 0.9000
5/5 [==============================] - 0s 2ms/step - loss: 0.2393 - accuracy: 0.9583
5/5 [==============================] - 0s 32ms/step - loss: 0.2393 - accuracy: 0.9583 - val_loss: 0.4505 - val_accuracy: 0.8800
Epoch 176/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2440 - accuracy: 0.9500
5/5 [==============================] - 0s 2ms/step - loss: 0.2372 - accuracy: 0.9583
5/5 [==============================] - 0s 34ms/step - loss: 0.2372 - accuracy: 0.9583 - val_loss: 0.4497 - val_accuracy: 0.8800
Epoch 177/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1796 - accuracy: 1.0000
5/5 [==============================] - 0s 669us/step - loss: 0.2361 - accuracy: 0.9583
5/5 [==============================] - 0s 26ms/step - loss: 0.2361 - accuracy: 0.9583 - val_loss: 0.4492 - val_accuracy: 0.8800
Epoch 178/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2099 - accuracy: 0.9500
5/5 [==============================] - 0s 553us/step - loss: 0.2341 - accuracy: 0.9583
5/5 [==============================] - 0s 27ms/step - loss: 0.2341 - accuracy: 0.9583 - val_loss: 0.4442 - val_accuracy: 0.8800
Epoch 179/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2318 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.2327 - accuracy: 0.9583
5/5 [==============================] - 0s 31ms/step - loss: 0.2327 - accuracy: 0.9583 - val_loss: 0.4436 - val_accuracy: 0.8800
Epoch 180/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2123 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.2312 - accuracy: 0.9583
5/5 [==============================] - 0s 30ms/step - loss: 0.2312 - accuracy: 0.9583 - val_loss: 0.4430 - val_accuracy: 0.8800
Epoch 181/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2616 - accuracy: 0.9500
5/5 [==============================] - 0s 557us/step - loss: 0.2298 - accuracy: 0.9583
5/5 [==============================] - 0s 28ms/step - loss: 0.2298 - accuracy: 0.9583 - val_loss: 0.4432 - val_accuracy: 0.8800
Epoch 182/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2030 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.2279 - accuracy: 0.9583
5/5 [==============================] - 0s 30ms/step - loss: 0.2279 - accuracy: 0.9583 - val_loss: 0.4407 - val_accuracy: 0.8800
Epoch 183/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3550 - accuracy: 0.8500
5/5 [==============================] - 0s 2ms/step - loss: 0.2272 - accuracy: 0.9583
5/5 [==============================] - 0s 31ms/step - loss: 0.2272 - accuracy: 0.9583 - val_loss: 0.4387 - val_accuracy: 0.8800
Epoch 184/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2117 - accuracy: 1.0000
5/5 [==============================] - 0s 544us/step - loss: 0.2250 - accuracy: 0.9583
5/5 [==============================] - 0s 26ms/step - loss: 0.2250 - accuracy: 0.9583 - val_loss: 0.4361 - val_accuracy: 0.8800
Epoch 185/200
1/5 [=====>........................] - ETA: 0s - loss: 0.3096 - accuracy: 0.9000
5/5 [==============================] - 0s 600us/step - loss: 0.2237 - accuracy: 0.9583
5/5 [==============================] - 0s 30ms/step - loss: 0.2237 - accuracy: 0.9583 - val_loss: 0.4319 - val_accuracy: 0.8800
Epoch 186/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2136 - accuracy: 0.9500
5/5 [==============================] - 0s 2ms/step - loss: 0.2222 - accuracy: 0.9583
5/5 [==============================] - 0s 32ms/step - loss: 0.2222 - accuracy: 0.9583 - val_loss: 0.4301 - val_accuracy: 0.8800
Epoch 187/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2844 - accuracy: 0.9500
5/5 [==============================] - 0s 1ms/step - loss: 0.2206 - accuracy: 0.9583
5/5 [==============================] - 0s 31ms/step - loss: 0.2206 - accuracy: 0.9583 - val_loss: 0.4298 - val_accuracy: 0.8800
Epoch 188/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2844 - accuracy: 0.9000
5/5 [==============================] - 0s 1ms/step - loss: 0.2193 - accuracy: 0.9583
5/5 [==============================] - 0s 31ms/step - loss: 0.2193 - accuracy: 0.9583 - val_loss: 0.4287 - val_accuracy: 0.8800
Epoch 189/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1490 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.2177 - accuracy: 0.9583
5/5 [==============================] - 0s 30ms/step - loss: 0.2177 - accuracy: 0.9583 - val_loss: 0.4241 - val_accuracy: 0.8800
Epoch 190/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1908 - accuracy: 1.0000
5/5 [==============================] - 0s 793us/step - loss: 0.2167 - accuracy: 0.9583
5/5 [==============================] - 0s 29ms/step - loss: 0.2167 - accuracy: 0.9583 - val_loss: 0.4221 - val_accuracy: 0.8800
Epoch 191/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1632 - accuracy: 1.0000
5/5 [==============================] - 0s 647us/step - loss: 0.2147 - accuracy: 0.9583
5/5 [==============================] - 0s 26ms/step - loss: 0.2147 - accuracy: 0.9583 - val_loss: 0.4198 - val_accuracy: 0.8800
Epoch 192/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1862 - accuracy: 1.0000
5/5 [==============================] - 0s 694us/step - loss: 0.2135 - accuracy: 0.9583
5/5 [==============================] - 0s 27ms/step - loss: 0.2135 - accuracy: 0.9583 - val_loss: 0.4190 - val_accuracy: 0.8800
Epoch 193/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1209 - accuracy: 1.0000
5/5 [==============================] - 0s 1ms/step - loss: 0.2121 - accuracy: 0.9583
5/5 [==============================] - 0s 30ms/step - loss: 0.2121 - accuracy: 0.9583 - val_loss: 0.4193 - val_accuracy: 0.8800
Epoch 194/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1858 - accuracy: 1.0000
5/5 [==============================] - 0s 2ms/step - loss: 0.2103 - accuracy: 0.9583
5/5 [==============================] - 0s 33ms/step - loss: 0.2103 - accuracy: 0.9583 - val_loss: 0.4149 - val_accuracy: 0.8800
Epoch 195/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2436 - accuracy: 0.9500
5/5 [==============================] - 0s 898us/step - loss: 0.2091 - accuracy: 0.9583
5/5 [==============================] - 0s 29ms/step - loss: 0.2091 - accuracy: 0.9583 - val_loss: 0.4117 - val_accuracy: 0.8800
Epoch 196/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1953 - accuracy: 0.9500
5/5 [==============================] - 0s 3ms/step - loss: 0.2080 - accuracy: 0.9583
5/5 [==============================] - 0s 33ms/step - loss: 0.2080 - accuracy: 0.9583 - val_loss: 0.4088 - val_accuracy: 0.8800
Epoch 197/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1973 - accuracy: 1.0000
5/5 [==============================] - 0s 617us/step - loss: 0.2064 - accuracy: 0.9583
5/5 [==============================] - 0s 26ms/step - loss: 0.2064 - accuracy: 0.9583 - val_loss: 0.4097 - val_accuracy: 0.8800
Epoch 198/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1385 - accuracy: 1.0000
5/5 [==============================] - 0s 901us/step - loss: 0.2050 - accuracy: 0.9583
5/5 [==============================] - 0s 29ms/step - loss: 0.2050 - accuracy: 0.9583 - val_loss: 0.4058 - val_accuracy: 0.8800
Epoch 199/200
1/5 [=====>........................] - ETA: 0s - loss: 0.1962 - accuracy: 0.9500
5/5 [==============================] - 0s 2ms/step - loss: 0.2034 - accuracy: 0.9583
5/5 [==============================] - 0s 32ms/step - loss: 0.2034 - accuracy: 0.9583 - val_loss: 0.4059 - val_accuracy: 0.8800
Epoch 200/200
1/5 [=====>........................] - ETA: 0s - loss: 0.2389 - accuracy: 0.9500
5/5 [==============================] - 0s 3ms/step - loss: 0.2023 - accuracy: 0.9583
5/5 [==============================] - 0s 32ms/step - loss: 0.2023 - accuracy: 0.9583 - val_loss: 0.4052 - val_accuracy: 0.8800
plot(history) +
ggtitle("Training a neural network based classifier on the iris data set") +
theme_bw()
The final performance can be obtained like so.
perf <- model %>% evaluate(x_test, y_test)
1/1 [==============================] - 0s 10us/step - loss: 0.2131 - accuracy: 0.9310
1/1 [==============================] - 0s 190us/step - loss: 0.2131 - accuracy: 0.9310
print(perf)
loss accuracy
0.2130527 0.9310345
For the next plot the predicted and true values need to be in a vector. Note that the true values need to be unlisted before putting them into a numeric vector.
classes <- iris %>% pull(Species) %>% unique()
y_pred <- model %>% predict_classes(x_test)
y_true <- test %>% select(class_label) %>% unlist() %>% as.numeric()
tibble(y_true = classes[y_true + 1], y_pred = classes[y_pred + 1],
Correct = ifelse(y_true == y_pred, "Yes", "No") %>% factor) %>%
ggplot(aes(x = y_true, y = y_pred, colour = Correct)) +
geom_jitter() +
theme_bw() +
ggtitle(label = "Classification Performance of Artificial Neural Network",
subtitle = str_c("Accuracy = ",round(perf[2],3)*100,"%")) +
xlab(label = "True iris class") +
ylab(label = "Predicted iris class")
library(gmodels)
CrossTable(y_pred, y_true,
prop.chisq = FALSE, prop.t = FALSE, prop.r = FALSE,
dnn = c('predicted', 'actual'))
Cell Contents
|-------------------------|
| N |
| N / Col Total |
|-------------------------|
Total Observations in Table: 29
| actual
predicted | 0 | 1 | 2 | Row Total |
-------------|-----------|-----------|-----------|-----------|
0 | 11 | 0 | 0 | 11 |
| 1.000 | 0.000 | 0.000 | |
-------------|-----------|-----------|-----------|-----------|
1 | 0 | 10 | 0 | 10 |
| 0.000 | 0.833 | 0.000 | |
-------------|-----------|-----------|-----------|-----------|
2 | 0 | 2 | 6 | 8 |
| 0.000 | 0.167 | 1.000 | |
-------------|-----------|-----------|-----------|-----------|
Column Total | 11 | 12 | 6 | 29 |
| 0.379 | 0.414 | 0.207 | |
-------------|-----------|-----------|-----------|-----------|
I hope this illustrated just how easy it is to get started building artificial neural network using Keras and TensorFlow in R. With relative ease, we created a 3-class predictor with an accuracy of 100%. This was a basic minimal example. The network can be expanded to create Deep Learning networks and also the entire TensorFlow API is available.
Enjoy and Happy Learning!
Leon
Thanks again Leon, this was awesome!!!