This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# model.fit(img_iter, | |
# epochs=10, | |
# steps_per_epoch=len(x_train)/batch_size, # Run same number of steps we would if we were not using a generator. | |
# validation_data=(x_valid, y_valid)) | |
import matplotlib.pyplot as plt | |
# Plotting the training loss | |
plt.plot(model.history.history['loss'], label='Training Loss') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import logging.handlers | |
logf = logging.getLogger('MyLogger') | |
logf.setLevel(logging.INFO) | |
handler = logging.handlers.RotatingFileHandler( | |
'logfile.txt', maxBytes=100*1000*1000, backupCount=5) | |
logf.addHandler(handler) | |
logf.info('this is a log message') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ismulticast(hostname): | |
"""is this address a multicast address?""" | |
# -- yes if bits 0-3 are 1110 | |
import socket | |
import struct | |
ip=socket.gethostbyname(hostname) | |
mreq=struct.pack("4sl",socket.inet_aton(ip),socket.INADDR_ANY) | |
return ord(mreq[0]) & 0xf0 == 0xe0 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=['a1'] | |
b=['b1','b2','b3'] | |
c=['c1','c2'] | |
print zip(a,b,c) |