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 random | |
import tqdm | |
import numpy as np | |
import pylab as plt | |
def trial(): | |
coins = [] | |
for _ in range(10000): | |
coin = random.randint(0, 1) | |
# Monday | |
coins.append(coin) |
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 numpy as np | |
from scipy import stats | |
import pylab as plt | |
def compare(x, y, keys, name): | |
keys_ = set(keys).intersection(x).intersection(y) | |
print(set(keys) - keys_) | |
keys = set(keys).intersection(x).intersection(y) |
We can't make this file beautiful and searchable because it's too large.
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
dimension,indicator_id,indicator_name,iso3,country_name,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,9999 | |
Composite indices,146206,HDI rank,AFG,Afghanistan,,,,,,,,,,,,,,,,,,,,,,,,,,,168,168, | |
Composite indices,146206,HDI rank,ALB,Albania,,,,,,,,,,,,,,,,,,,,,,,,,,,69,68, | |
Composite indices,146206,HDI rank,DZA,Algeria,,,,,,,,,,,,,,,,,,,,,,,,,,,83,85, | |
Composite indices,146206,HDI rank,AND,Andorra,,,,,,,,,,,,,,,,,,,,,,,,,,,35,35, | |
Composite indices,146206,HDI rank,AGO,Angola,,,,,,,,,,,,,,,,,,,,,,,,,,,145,147, | |
Composite indices,146206,HDI rank,ATG,Antigua and Barbuda,,,,,,,,,,,,,,,,,,,,,,,,,,,70,70, | |
Composite indices,146206,HDI rank,ARG,Argentina,,,,,,,,,,,,,,,,,,,,,,,,,,,47,47, | |
Composite indices,146206,HDI rank,ARM,Armenia,,,,,,,,,,,,,,,,,,,,,,,,,,,84,83, | |
Composite indices,146206,HDI rank,AUS,Australia,,,,,,,,,,,,,,,,,,,,,,,,,,,3,3, |
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
$ pip install pygaussdca | |
Collecting pygaussdca | |
Using cached https://files.pythonhosted.org/packages/f9/e5/5df8d0224318f5811c64e026ae4cd5af37288238a0b259186983e55be19c/pyGaussDCA-0.1.2.tar.gz | |
Requirement already satisfied: numpy in /home/david/.virtualenv/py36/lib/python3.6/site-packages (from pygaussdca) (1.16.0) | |
Requirement already satisfied: scipy in /home/david/.virtualenv/py36/lib/python3.6/site-packages (from pygaussdca) (1.2.0) | |
Requirement already satisfied: pythran>=0.8.6 in /home/david/.virtualenv/py36/lib/python3.6/site-packages (from pygaussdca) (0.9.1) | |
Requirement already satisfied: ply>=3.4 in /home/david/.virtualenv/py36/lib/python3.6/site-packages (from pythran>=0.8.6->pygaussdca) (3.11) | |
Requirement already satisfied: networkx>=2 in /home/david/.virtualenv/py36/lib/python3.6/site-packages (from pythran>=0.8.6->pygaussdca) (2.2) | |
Requirement already satisfied: gast in /home/david/.virtualenv/py36/lib/python3.6/site-packages (from pythran>=0.8.6->py |
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 keras.backend as K | |
from keras.models import Model, load_model | |
from keras.layers import Input, BatchNormalization | |
from keras.layers import Conv1D | |
def add_1D_conv(model, filters, kernel_size): | |
model = Conv1D(filters, kernel_size)(model) | |
model = BatchNormalization()(model) | |
return model |
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 __future__ import division | |
import keras | |
import keras.backend as K | |
from keras.models import Model, load_model | |
from keras.layers import Input, Dropout, BatchNormalization | |
from keras.layers import Conv2D, Conv1D | |
from keras.layers.core import Lambda | |
from keras.regularizers import l2 | |
from keras.layers.advanced_activations import ELU |
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
$ kernprof -lv scratch_4.py | |
Line # Hits Time Per Hit % Time Line Contents | |
============================================================== | |
13 @profile | |
14 def run(): | |
15 1 47 47.0 0.1 midpoints = k[:-1] + np.diff(k)/2 | |
16 1 43 43.0 0.1 idx_aux = np.searchsorted(sortedA, midpoints) | |
17 1 1 1.0 0.0 idx = [] |
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 tables | |
class H5Generator(object): | |
def __init__(self, h5file): | |
self.h5 = tables.open_file(h5file) | |
self.n_rows = int(self.h5.root.target.shape[0]) | |
self.ix = 0 | |
self.feature_keys = ('atom_contacts', 'residue_contacts', 'rsa', 'surface_area_bins', 'dssp_ss', 'pssm') | |
self.target_key = 's_score' |
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 __future__ import division | |
import collections | |
from keras import backend as K | |
from keras import activations, initializations, regularizers, constraints | |
from keras.engine import InputSpec | |
from keras.engine.topology import Layer | |
class Tensordot(Layer): |
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
(py27)[david@SQUIDS gpy_memtest]$ python memtest.py gpy | |
/home/david/.virtualenvs/py27/lib/python2.7/site-packages/numpy/core/numeric.py:294: FutureWarning:in the future, full((3, 3), 666) will return an array of dtype('int64') | |
/home/david/.virtualenvs/py27/lib/python2.7/site-packages/numpy/core/numeric.py:294: FutureWarning:in the future, full((3, 1), 42) will return an array of dtype('int64') | |
0 | |
[] | |
191 | |
[<GPy.models.gp_regression.GPRegression object at 0x7f97ce48f0d0>, {'_added_names_': set(['Gaussian_noise', 'rbf']), 'sampling_runs': [], 'mean_function': None, 'Y_normalized': ObsAr([[ 42.], | |
[ 42.], | |
[ 42.]]), '_fixes_': None, '_optimizer_copy_transformed': False, 'size': 3, 'parameters': [<GPy.core.parameterization.ties_and_remappings.Tie object at 0x7f97ce48fd90>, <GPy.kern._src.rbf.RBF object at 0x7f97ce48f1d0>, <GPy.likelihoods.gaussian.Gaussian object at 0x7f97ce48f850>], 'priors': <GPy.core.parameterization.index_operations.ParameterIndexOperations object at 0x7f97ce48fb50>, 'output_dim': |