From June 26, 2016 (python 3.5.2 release) to Aug. 31, 2016.
Python versions from 2.6 to 3.5
Without 2.7
| from __future__ import print_function, division | |
| from math import sqrt | |
| from scipy.special import ndtri | |
| def _proportion_confidence_interval(r, n, z): | |
| """Compute confidence interval for a proportion. | |
| Follows notation described on pages 46--47 of [1]. |
| bind -T root F12 \ | |
| set prefix None \;\ | |
| set key-table off \;\ | |
| set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\ | |
| set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\ | |
| set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\ | |
| if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\ | |
| refresh-client -S \;\ | |
| bind -T off F12 \ |
| from keras.models import Sequential | |
| from keras.models import model_from_json | |
| from keras import backend as K | |
| import tensorflow as tf | |
| from tensorflow.python.tools import freeze_graph | |
| import os | |
| # Load existing model. | |
| with open("model.json",'r') as f: | |
| modelJSON = f.read() |
| from scipy.stats import norm, shapiro, kstest, anderson | |
| import bokeh.plotting as bplt | |
| from bokeh import layouts | |
| from bokeh.charts import Histogram, Scatter | |
| from bokeh.models import Span | |
| import pandas as pd | |
| import numpy as np | |
| def vertical_histogram(y): |
| #!/usr/bin/env bash | |
| # Path to the project directory (that should include requirements.txt), | |
| # Files and directories within that need to be deployed. | |
| project=../backend | |
| contents=(module lamdba_handler.py) | |
| # Unnecessary parts. Note that there are some inter-dependencies in SciPy, | |
| # for example to use scipy.stats you also need scipy.linalg, scipy.integrate, | |
| # scipy.misc, scipy.sparse, and scipy.special. |
| """ | |
| A weighted version of categorical_crossentropy for keras (2.0.6). This lets you apply a weight to unbalanced classes. | |
| @url: https://gist.github.com/wassname/ce364fddfc8a025bfab4348cf5de852d | |
| @author: wassname | |
| """ | |
| from keras import backend as K | |
| def weighted_categorical_crossentropy(weights): | |
| """ | |
| A weighted version of keras.objectives.categorical_crossentropy | |
| '''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 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 |
| """ Deep Auto-Encoder implementation | |
| An auto-encoder works as follows: | |
| Data of dimension k is reduced to a lower dimension j using a matrix multiplication: | |
| softmax(W*x + b) = x' | |
| where W is matrix from R^k --> R^j | |
| A reconstruction matrix W' maps back from R^j --> R^k |