Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 csv | |
# import os | |
# import numpy as np | |
# from cervantes.box import WordVectorBox | |
# from cervantes.language import OneLevelEmbedding | |
# from cervantes.nn.models import RNNClassifier | |
# from cervantes.box import EnglishCharBox | |
from keras.models import Model, Sequential |
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 | |
import numpy as np | |
def custom_uniform(shape, range=(-1, 1), name=None): | |
min_, max_ = range | |
return K.variable(np.random.uniform(low=min_, high=max_, size=shape), name=name) | |
net.add(Dense(10, input_dim=5, init=lambda shape, name: custom_uniform(shape, (-10, 5), name))) |
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 | |
class NDWeights(object): | |
''' | |
An n-dimension reweighting object | |
''' | |
def __init__(self, bins): | |
''' | |
Constructor for weighting | |
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 rootpy.vector import LorentzVector | |
class Jet(object): | |
""" | |
Better Jet Class! | |
Example: | |
>>> j = Jet(100.1, 1.2, 1.0, 12) | |
>>> j.lv.Pt() |
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
''' | |
hacked out deepdish.io style keras NN saving functionality | |
[credit] deepdish | |
''' | |
from __future__ import division, print_function, absolute_import | |
import numpy as np | |
import tables | |
import warnings |
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
#!/usr/bin/env bash | |
# bootstrap.sh | |
# author: Luke de Oliveira ([email protected]) | |
# boostrap script for clean (CPU) EC2 instance setup for machine learning. | |
# -- get a basic build up | |
sudo apt-get update && sudo apt-get upgrade | |
sudo apt-get install -y build-essential | |
# -- dev builds of key software |
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 setuptools import setup | |
from setuptools import find_packages | |
setup( | |
name='NewPackage', | |
version='0.0.1', | |
description='Library for doing a thing.', | |
author='Luke de Oliveira', | |
author_email='[email protected]', | |
url='https://github.com/lukedeo/repo', |
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
class TrainingHandler(object): | |
def __init__(self, sig=signal.SIGINT): | |
self.sig = sig | |
def __enter__(self): | |
self.interrupted = False | |
self.released = False | |
self.original_handler = signal.getsignal(self.sig) | |
def handler(signum, frame): | |
self.release() |
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 | |
import math | |
import matplotlib.pyplot as plt | |
import matplotlib.tri as tri | |
from matplotlib.mlab import griddata | |
from matplotlib import rc | |
import numpy.ma as ma | |
def data_load(filename): | |
data = np.genfromtxt(filename, delimiter = ',', names = True) |
NewerOlder