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
if you are using linux, unix, os x:
pip install -U setuptools
pip install -U pip
pip install numpy
pip install scipy
pip install matplotlib
#pip install PySide
| ''' | |
| Non-parametric computation of entropy and mutual-information | |
| Adapted by G Varoquaux for code created by R Brette, itself | |
| from several papers (see in the code). | |
| This code is maintained at https://github.com/mutualinfo/mutual_info | |
| Please download the latest code there, to have improvements and | |
| bug fixes. |
| http { | |
| ... | |
| proxy_cache_path /data/perch.squaremill.com/shared/image_cache levels=1:2 keys_zone=images:10m; | |
| ... | |
| } |
| [alias] | |
| a = help | |
| ai = init | |
| aichas = revert | |
| alaks = mv | |
| apan = rebase | |
| diks = show | |
| feri = clone | |
| flaks = stash save | |
| graps = commit |
Your Flask app object implements the __call__ method, which means it can be called like a regular function.
When your WSGI container receives a HTTP request it calls your app with the environ dict and the start_response callable.
WSGI is specified in PEP 0333.
The two relevant environ variables are:
SCRIPT_NAME
The initial portion of the request URL's "path" that corresponds to the application object, so that the application knows its virtual "location". This may be an empty string, if the application corresponds to the "root" of the server.
| from keras.models import Sequential | |
| from keras.layers import Dense | |
| from keras.utils.io_utils import HDF5Matrix | |
| import numpy as np | |
| def create_dataset(): | |
| import h5py | |
| X = np.random.randn(200,10).astype('float32') | |
| y = np.random.randint(0, 2, size=(200,1)) | |
| f = h5py.File('test.h5', 'w') |
| '''This script goes along the blog post | |
| "Building powerful image classification models using very little data" | |
| from blog.keras.io. | |
| It uses data that can be downloaded at: | |
| https://www.kaggle.com/c/dogs-vs-cats/data | |
| In our setup, we: | |
| - created a data/ folder | |
| - created train/ and validation/ subfolders inside data/ | |
| - created cats/ and dogs/ subfolders inside train/ and validation/ | |
| - put the cat pictures index 0-999 in data/train/cats |
This is an Keras implementation of ResNet-152 with ImageNet pre-trained weights. I converted the weights from Caffe provided by the authors of the paper. The implementation supports both Theano and TensorFlow backends. Just in case you are curious about how the conversion is done, you can visit my blog post for more details.
ResNet Paper:
Deep Residual Learning for Image Recognition.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun
arXiv:1512.03385