'''
FROM https://raw.githubusercontent.com/keras-team/keras/master/examples

Example of Notifyker usage in training of keras LSTM model
'''
from __future__ import print_function

from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense, Embedding
from keras.layers import LSTM
from keras.datasets import imdb

import notifyker  # import package


max_features = 20000
maxlen = 80
batch_size = 32

print('Loading data...')
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
print(len(x_train), 'train sequences')
print(len(x_test), 'test sequences')

print('Pad sequences (samples x time)')
x_train = sequence.pad_sequences(x_train, maxlen=maxlen)
x_test = sequence.pad_sequences(x_test, maxlen=maxlen)
print('x_train shape:', x_train.shape)
print('x_test shape:', x_test.shape)

print('Build model...')
model = Sequential()
model.add(Embedding(max_features, 128))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
              optimizer='adam',
              metrics=['accuracy'])

# Set your own credits
TOKEN = '732354002:AAE_vHVNieg1e16fZDG79OKF8fF4cNq_rFE'
PROXY = {'proxy_url': 'socks5h://217.182.216.119:5001', 'urllib3_proxy_kwargs': {'username': 'wop', 'password': 'Tm24&10aQSc'}}

# create telegram notifier instance
ntf = notifyker.NotifierTelegramMenu(TOKEN=TOKEN, PROXY=PROXY)
# create keras callback
callback = notifyker.CallbackSimple(notifier=ntf)

print('Train...')
model.fit(x_train, y_train,
          batch_size=batch_size,
          epochs=15,
          validation_data=(x_test, y_test),
          callbacks=[callback])  # set callback here

score, acc = model.evaluate(x_test, y_test,
                            batch_size=batch_size)
print('Test score:', score)
print('Test accuracy:', acc)

c3c65c6a78367eadc9b7ff4c3c9c887c1d0fb37f
<mask token>

<mask token>
print('Loading data...')
<mask token>
print(len(x_train), 'train sequences')
print(len(x_test), 'test sequences')
print('Pad sequences (samples x time)')
<mask token>
print('x_train shape:', x_train.shape)
print('x_test shape:', x_test.shape)
print('Build model...')
<mask token>
model.add(Embedding(max_features, 128))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=[
    'accuracy'])
<mask token>
print('Train...')
model.fit(x_train, y_train, batch_size=batch_size, epochs=15,
    validation_data=(x_test, y_test), callbacks=[callback])
<mask token>
print('Test score:', score)
print('Test accuracy:', acc)

<mask token>
max_features = 20000
maxlen = 80
batch_size = 32
print('Loading data...')
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
print(len(x_train), 'train sequences')
print(len(x_test), 'test sequences')
print('Pad sequences (samples x time)')
x_train = sequence.pad_sequences(x_train, maxlen=maxlen)
x_test = sequence.pad_sequences(x_test, maxlen=maxlen)
print('x_train shape:', x_train.shape)
print('x_test shape:', x_test.shape)
print('Build model...')
model = Sequential()
model.add(Embedding(max_features, 128))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=[
    'accuracy'])
TOKEN = '732354002:AAE_vHVNieg1e16fZDG79OKF8fF4cNq_rFE'
PROXY = {'proxy_url': 'socks5h://217.182.216.119:5001',
    'urllib3_proxy_kwargs': {'username': 'wop', 'password': 'Tm24&10aQSc'}}
ntf = notifyker.NotifierTelegramMenu(TOKEN=TOKEN, PROXY=PROXY)
callback = notifyker.CallbackSimple(notifier=ntf)
print('Train...')
model.fit(x_train, y_train, batch_size=batch_size, epochs=15,
    validation_data=(x_test, y_test), callbacks=[callback])
score, acc = model.evaluate(x_test, y_test, batch_size=batch_size)
print('Test score:', score)
print('Test accuracy:', acc)

<mask token>
from __future__ import print_function
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense, Embedding
from keras.layers import LSTM
from keras.datasets import imdb
import notifyker
max_features = 20000
maxlen = 80
batch_size = 32
print('Loading data...')
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
print(len(x_train), 'train sequences')
print(len(x_test), 'test sequences')
print('Pad sequences (samples x time)')
x_train = sequence.pad_sequences(x_train, maxlen=maxlen)
x_test = sequence.pad_sequences(x_test, maxlen=maxlen)
print('x_train shape:', x_train.shape)
print('x_test shape:', x_test.shape)
print('Build model...')
model = Sequential()
model.add(Embedding(max_features, 128))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=[
    'accuracy'])
TOKEN = '732354002:AAE_vHVNieg1e16fZDG79OKF8fF4cNq_rFE'
PROXY = {'proxy_url': 'socks5h://217.182.216.119:5001',
    'urllib3_proxy_kwargs': {'username': 'wop', 'password': 'Tm24&10aQSc'}}
ntf = notifyker.NotifierTelegramMenu(TOKEN=TOKEN, PROXY=PROXY)
callback = notifyker.CallbackSimple(notifier=ntf)
print('Train...')
model.fit(x_train, y_train, batch_size=batch_size, epochs=15,
    validation_data=(x_test, y_test), callbacks=[callback])
score, acc = model.evaluate(x_test, y_test, batch_size=batch_size)
print('Test score:', score)
print('Test accuracy:', acc)

'''
FROM https://raw.githubusercontent.com/keras-team/keras/master/examples

Example of Notifyker usage in training of keras LSTM model
'''
from __future__ import print_function

from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense, Embedding
from keras.layers import LSTM
from keras.datasets import imdb

import notifyker  # import package


max_features = 20000
maxlen = 80
batch_size = 32

print('Loading data...')
(x_train, y_train), (x_test, y_test) = imdb.load_data(num_words=max_features)
print(len(x_train), 'train sequences')
print(len(x_test), 'test sequences')

print('Pad sequences (samples x time)')
x_train = sequence.pad_sequences(x_train, maxlen=maxlen)
x_test = sequence.pad_sequences(x_test, maxlen=maxlen)
print('x_train shape:', x_train.shape)
print('x_test shape:', x_test.shape)

print('Build model...')
model = Sequential()
model.add(Embedding(max_features, 128))
model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2))
model.add(Dense(1, activation='sigmoid'))

model.compile(loss='binary_crossentropy',
              optimizer='adam',
              metrics=['accuracy'])

# Set your own credits
TOKEN = '732354002:AAE_vHVNieg1e16fZDG79OKF8fF4cNq_rFE'
PROXY = {'proxy_url': 'socks5h://217.182.216.119:5001', 'urllib3_proxy_kwargs': {'username': 'wop', 'password': 'Tm24&10aQSc'}}

# create telegram notifier instance
ntf = notifyker.NotifierTelegramMenu(TOKEN=TOKEN, PROXY=PROXY)
# create keras callback
callback = notifyker.CallbackSimple(notifier=ntf)

print('Train...')
model.fit(x_train, y_train,
          batch_size=batch_size,
          epochs=15,
          validation_data=(x_test, y_test),
          callbacks=[callback])  # set callback here

score, acc = model.evaluate(x_test, y_test,
                            batch_size=batch_size)
print('Test score:', score)
print('Test accuracy:', acc)
