A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
| from matplotlib.animation import FuncAnimation | |
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| fig, ax = plt.subplots(figsize=(5, 8)) | |
| def update(i): | |
| im_normed = np.random.random((64, 64)) | |
| ax.imshow(im_normed) |
| # Note – this is not a bash script (some of the steps require reboot) | |
| # I named it .sh just so Github does correct syntax highlighting. | |
| # | |
| # This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5 | |
| # | |
| # The CUDA part is mostly based on this excellent blog post: | |
| # http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/ | |
| # Install various packages | |
| sudo apt-get update |
| import folium | |
| import pandas as pd | |
| # Map init. | |
| map_osm = folium.Map() | |
| data = pd.read_csv('data.csv') | |
| data_ = data[['LATITUDE (HIGH ACCURACY)','LONGITUDE (HIGH ACCURACY)']].astype(float) | |
| for index, row in data_.iterrows(): |
| import cv2 | |
| import os | |
| import numpy as np | |
| import pandas as pd | |
| from sys import exit | |
| from collections import Counter | |
| from sklearn import preprocessing | |
| from sklearn.cross_validation import train_test_split | |
| from keras.utils.np_utils import to_categorical | |
| from keras.models import Sequential |
| from sys import exit | |
| import time | |
| import os.path | |
| from sys import exit | |
| from subprocess import call | |
| import datetime | |
| import urllib | |
| # years | |
| years = [2016] |
| import os | |
| os.environ["THEANO_FLAGS"] = "device=gpu,floatX=float32" | |
| from theano import function, config, shared, sandbox | |
| import theano.tensor as T | |
| import numpy | |
| import time | |
| vlen = 10 * 30 * 768 # 10 x #cores x # threads per core | |
| iters = 1000 |
| installation guide for spot GPU instances : | |
| * MUSTS : | |
| - sudo apt-get update | |
| - sudo apt-get -y dist-upgrade | |
| - sudo apt-get install -y gcc g++ gfortran build-essential git wget linux-image-generic libopenblas-dev python-dev python-pip python-nose python-numpy python-scipy | |
| - sudo apt-get install -y liblapack-dev | |
| - sudo apt-get install -y libblas-dev |
| C | H | T | W | DP | DateUTC | Type | CON | |
|---|---|---|---|---|---|---|---|---|
| Fes-Sais | 46.018711076 | 24.4734074096 | 12.8436834369 | 13.6771496248 | 2016-06-25 20:00:00 | 72 | Clear | |
| Fes-Sais | 41.8126554348 | 26.3298100303 | 12.7266287124 | 14.6923411172 | 2016-06-25 21:00:00 | 72 | Clear | |
| Fes-Sais | 43.505598531 | 25.7060682843 | 12.3009745827 | 14.4071879905 | 2016-06-25 22:00:00 | 72 | Clear | |
| Fes-Sais | 48.0412325718 | 24.0021621803 | 11.7006364947 | 13.6104086947 | 2016-06-25 23:00:00 | 72 | Clear | |
| Fes-Sais | 53.3471927502 | 22.0347349117 | 10.9991886353 | 12.7041734618 | 2016-06-26 00:00:00 | 72 | Clear | |
| Fes-Sais | 58.11953424 | 20.2713587875 | 10.2604195077 | 11.8952656355 | 2016-06-26 01:00:00 | 72 | Clear | |
| Fes-Sais | 61.617390857 | 18.9699977333 | 9.55777011478 | 11.2934759047 | 2016-06-26 02:00:00 | 72 | Clear | |
| Fes-Sais | 63.4916280367 | 18.2593624401 | 8.97471670473 | 10.9576880474 | 2016-06-26 03:00:00 | 72 | Clear | |
| Fes-Sais | 63.6550310709 | 18.1831970433 | 8.59613211566 | 10.9142032575 | 2016-06-26 04:00:00 | 72 | Clear |