plac makes parsing arguments from the command line easy.
plac Documentation: https://micheles.github.io/plac/
This short guide will only cover the decorator function plac.annotations().
| import scipy.stats as scs | |
| def min_sample_size(bcr, mde, power=0.8, sig_level=0.05): | |
| """Returns the minimum sample size to set up a split test | |
| Arguments: | |
| bcr (float): probability of success for control, sometimes | |
| referred to as baseline conversion rate | |
| mde (float): minimum change in measurement between control |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import scipy.stats as scs | |
| def z_val(sig_level=0.05, two_tailed=True): | |
| """Returns the z value for a given significance level""" | |
| z_dist = scs.norm() | |
| if two_tailed: | |
| sig_level = sig_level/2 | |
| area = 1 - sig_level |
| import yaml | |
| with open("apikey.yaml", 'r') as f: | |
| try: | |
| credentials_dict = yaml.load(f) | |
| except yaml.YAMLError as exc: | |
| print(exc) |
| # update the virtual machine | |
| sudo apt-get update | |
| # install nginx | |
| sudo apt-get install nginx | |
| # check version | |
| sudo nginx -v | |
| # start the nginx service |
| # install docker | |
| sudo apt-get install docker | |
| # the above command did not work (8/24/18); try the command below | |
| sudo curl -sSL https://get.docker.com/ | sh | |
| # pull nginx image | |
| sudo docker pull nginx:1.10.0 | |
| sudo docker images | |
| # verify the versions match |
| """simple Dockerfile | |
| FROM alpine:3.1 # starter image (typical) | |
| MAINTAINER <name> <email> | |
| ADD hello /usr/bin/hello # ADD <bin> <path-on-image> | |
| ENTRYPOINT ["hello"] # run hello app on startup | |
| """ | |
| # install GO | |
| wget https://storage.googleapis.com/golang/go1.6.2.linux-amd64.tar.gz | |
| rm -rf /usr/local/bin/go |
| # see all images | |
| sudo docker images | |
| # docker tag command help | |
| docker tag --help | |
| # add your tag to the image | |
| sudo docker tag monolith:1.0.0 <your username>/monolith:1.0.0 | |
| # you can also rename the image | |
| sudo docker tag monolith:1.0.0 udacity/example-monolith:1.0.0 |
plac makes parsing arguments from the command line easy.
plac Documentation: https://micheles.github.io/plac/
This short guide will only cover the decorator function plac.annotations().
| # set bins to the (number of bins + 1) - 0.5 to center the bar on the right x-label | |
| df['col_name'].hist(xrot=90, figsize=(12,6), rwidth=0.5, bins=np.arange(9)-0.5) |
| from flask import Flask | |
| from flask_restful import reqparse, abort, Api, Resource | |
| import pickle | |
| import numpy as np | |
| from model import NLPModel | |
| app = Flask(__name__) | |
| api = Api(app) | |
| model = NLPModel() |