<jupyter_start><jupyter_text>Console-command:  tensorboard --logdir logs/fit<jupyter_code>import tensorflow

tensorflow.config.experimental.list_physical_devices('GPU')
print("Num GPUs Available: ", len(tensorflow.config.experimental.list_physical_devices('GPU')))
from tensorflow.keras.models import  Sequential
from tensorflow.keras.layers import  Dense, Dropout, Activation, Conv2D, Flatten, MaxPooling2D
from tensorflow.keras.callbacks import TensorBoard
import time
import datetime
import pickle
from numpy import array

pickle_in = open("x_train.pickle", "rb")
x_train = pickle.load(pickle_in)

pickle_in = open("x_test.pickle", "rb")
x_test = pickle.load(pickle_in)

pickle_in = open("y_train.pickle", "rb")
y_train = array(pickle.load(pickle_in))

pickle_in = open("y_test.pickle", "rb")
y_test = array(pickle.load(pickle_in))

# Normalize

x_train = x_train / 255.0
x_test = x_test / 255.0
#x_train = tensorflow.keras.utils.normalize(x_train, axis = 1) # try to use TS.normalize
#x_test = tensorflow.keras.utils.normalize(x_test, axis = 1)
# Build model

model = Sequential()

model.add( Conv2D(256, (3,3), input_shape = x_train.shape[1:]) )
model.add( Activation('relu') )
model.add( MaxPooling2D(pool_size=(2,2)) )

model.add( Conv2D(256, (3,3) ))
model.add( Activation('relu') )
model.add( MaxPooling2D(pool_size=(2,2)) )

model.add( Flatten() )
model.add( Dense(64) )
model.add( Activation('relu') )

model.add( Dense(1) )
model.add( Activation('sigmoid') )

#optimizer='rmsprop',
#loss='categorical_crossentropy',
model.compile(loss='binary_crossentropy',
              optimizer='rmsprop',
              metrics=['accuracy'])

log_dir = "logs\\fit\\" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = TensorBoard(log_dir=log_dir, histogram_freq=1)

model.fit(x_train, y_train, batch_size=32, epochs=20, validation_split=0.2, callbacks=[tensorboard_callback])
model.evaluate(x_test, y_test, verbose=2)<jupyter_output>Train on 15964 samples, validate on 3992 samples
Epoch 1/20
15964/15964 [==============================] - 17s 1ms/sample - loss: 0.6452 - accuracy: 0.6295 - val_loss: 0.5767 - val_accuracy: 0.6976
Epoch 2/20
15964/15964 [==============================] - 14s 890us/sample - loss: 0.5369 - accuracy: 0.7342 - val_loss: 0.5238 - val_accuracy: 0.7395
Epoch 3/20
15964/15964 [==============================] - 14s 896us/sample - loss: 0.4826 - accuracy: 0.7735 - val_loss: 0.4669 - val_accuracy: 0.7846
Epoch 4/20
15964/15964 [==============================] - 14s 890us/sample - loss: 0.4337 - accuracy: 0.7990 - val_loss: 0.4703 - val_accuracy: 0.7786
Epoch 5/20
15964/15964 [==============================] - 14s 886us/sample - loss: 0.3845 - accuracy: 0.8275 - val_loss: 0.4898 - val_accuracy: 0.7698
Epoch 6/20
15964/15964 [==============================] - 14s 886us/sample - loss: 0.3336 - accuracy: 0.8539 - val_loss: 0.4719 - val_accuracy: 0.7883
Epoch 7/20
15964/15964 [=======================[...]<jupyter_text>Enter in serch: \w<jupyter_code># training with epochs and display graph accuracy for every epochs 

import time
import matplotlib.pyplot as plt
import numpy

start = time.clock()

epochs = 4
training_accuracy = []
test_accuracy = []

for i in range(epochs):
    print("_________________________")
    print("Epochs: ", i + 1)

    training_result = model.fit(x_train, y_train, batch_size=32, epochs=1, validation_split=0.2)
    test_result = model.evaluate(x_test, y_test, verbose=2)

    training_accuracy.append(training_result.history['accuracy'])
    test_accuracy.append(test_result[1])


epochs_list = numpy.arange(epochs)
plt.ylabel('Accuracy')
plt.xlabel('Epochs')
plt.plot(epochs_list, training_accuracy, label='Training')
plt.plot(epochs_list, test_accuracy, label='Test')
plt.grid(True)
plt.legend()
plt.show()


end = time.clock()
print(end - start)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18877682958365657, 'fraction_numerical': 0.07732092061029222, 'mean_word_length': 5.446666666666666, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '227431', 'license': 'MIT', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1417, 'n_words': 279, 'path': 'DL.TensorFlow.Keras.Python/Lesson 1-6/TensorBoard/AnalyzingModels.ipynb', 'repo_name': 'Golfyrs/ML.Study', 'size': '3867'}