Code for Keras plays catch blog post
python qlearn.py- Generate figures
| import random | |
| class Markov(object): | |
| def __init__(self, open_file, chain_size=3): | |
| self.chain_size = chain_size | |
| self.cache = {} | |
| self.open_file = open_file | |
| self.words = self.file_to_words() | |
| self.word_size = len(self.words) |
| from Queue import Queue | |
| import sys | |
| from threading import Thread | |
| import requests | |
| headers = { | |
| 'x-same-domain': '1', | |
| 'origin': 'https://mail.google.com', |
| import random | |
| from flask import Flask | |
| app = Flask(__name__) | |
| def find_prime(start): | |
| """ | |
| Find a prime greater than `start`. | |
| """ | |
| current = start |
| user www-data; | |
| worker_processes 4; | |
| pid /run/nginx.pid; | |
| events { | |
| worker_connections 768; | |
| # multi_accept on; | |
| } | |
| http { |
| description "Consul server" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| script | |
| # Make sure to use all our CPUs, because Consul can block a scheduler thread | |
| export GOMAXPROCS=`nproc` |
| user www-data; | |
| worker_processes 4; | |
| pid /run/nginx.pid; | |
| events { | |
| worker_connections 768; | |
| # multi_accept on; | |
| } | |
| http { |
| user www-data; | |
| worker_processes 4; | |
| pid /run/nginx.pid; | |
| events { | |
| worker_connections 768; | |
| # multi_accept on; | |
| } | |
| http { |
| description "Consul server" | |
| start on runlevel [2345] | |
| stop on runlevel [!2345] | |
| respawn | |
| script | |
| # Make sure to use all our CPUs, because Consul can block a scheduler thread | |
| export GOMAXPROCS=`nproc` |
| _ | |
| | \ | |
| | | | |
| | | | |
| |\ | | | |
| /, ~\ / / | |
| X `-.....-------./ / | |
| ~-. ~ ~ | | |
| \ / | | |
| \ /_ ___\ / |
Code for Keras plays catch blog post
python qlearn.py