This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Because I always forget how to do this. | |
# | |
# Credit: https://scipython.com/blog/visualizing-the-bivariate-gaussian-distribution/ | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import cm | |
from mpl_toolkits.mplot3d import Axes3D | |
from scipy.stats import multivariate_normal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""============================================================================= | |
Autoencoder based on "vanilla_ae" that has good results on CelebA: | |
Credit: https://github.com/bhpfelix/Variational-Autoencoder-PyTorch | |
=============================================================================""" | |
from torch import nn | |
from torch.nn import functional as F | |
# ------------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.stats import multivariate_normal | |
N = 200 | |
X = np.linspace(-4, 4, N) | |
Y = np.linspace(-4, 4, N) | |
X, Y = np.meshgrid(X, Y) | |
pos = np.dstack((X, Y)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "/myapp", | |
"cmd": null, | |
"cpus": 1, | |
"mem": 4096, | |
"disk": 0, | |
"instances": 1, | |
"constraints": [ | |
[ | |
"hostname", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""------------------------------------------------------------------------------- | |
- Use docstrings (https://www.python.org/dev/peps/pep-0008/#documentation-strings) | |
to describe each function at a high level. They are not always required, but I | |
think it's a good habit to write them. | |
- Internal functions should be prefixed with a single underscore | |
(https://www.python.org/dev/peps/pep-0008/#id41). | |
- `_url_encode` - I would not put implementation details in the a comment | |
describing the function. The user of a function should not care *how* the URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
import re | |
import pdb | |
# http://tools.ietf.org/html/rfc3986#section-3.3 | |
""" | |
>> c = request.urlparse("http://gregorygundersen.com") | |
>> c | |
ParseResult(scheme='http', netloc='gregorygundersen.com', path='', params='', query='', fragment='') | |
""" |