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
"""Extract reference documentation from the NumPy source tree. | |
""" | |
import inspect | |
import textwrap | |
import re | |
import sys | |
import types |
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
# These hyperparameters, identified by David Warde-Farley via random search, | |
# obtain 1.08% on MNIST, nearly matching the 1.05% in Nitish Srivastava's | |
# Master's thesis. | |
# | |
# An important difference is that this uses only the first 50,000 examples | |
# and does early stopping on a validation set of the last 10,000 training | |
# points, whereas Nitish Srivastava's results trained on the entire training | |
# set for a given number of epochs. It is quite possible that re-training | |
# with these hyperparameters on the entire 60,000 using some alternate stopping | |
# criterion (matching the best training set likelihood of this job, for instance, |
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 functools import wraps | |
import sys | |
# Goddamnit Python 2/3 differences. | |
str_type = str if sys.version_info[0] >= '3' else basestring | |
def filename_or_file_like(mode): | |
"""Decorator that checks if the first argument to a function is |
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
try: | |
from queue import Queue, Empty | |
except ImportError: | |
from Queue import Queue, Empty | |
import threading | |
import numpy | |
from numpy.lib.format import read_magic, read_array_header_1_0 | |
class BufferedChunkedNPY(object): |
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
# Copyright (c) 2015 David Warde-Farley. | |
# | |
# Permission is granted to use this code under the MIT license: | |
# http://opensource.org/licenses/mit-license.php | |
import logging | |
import progressbar | |
import time | |
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 MobileShellMousefix < Formula | |
homepage "http://mosh.mit.edu/" | |
revision 2 | |
head do | |
url "https://github.com/lpkruger/mosh.git", :revision => "d5f75ec54a" | |
depends_on "autoconf" => :build | |
depends_on "automake" => :build | |
end |
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
"""Very simple PUSH-PULL reusable producer-consumer with ZeroMQ.""" | |
# By David Warde-Farley. Released under the 3-clause BSD license. | |
import time | |
from multiprocessing import Process | |
import zmq | |
def _producer_wrapper(f, port, addr='tcp://127.0.0.1'): |
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
""" | |
A demonstration of how to deal with object-specific random number | |
generator states. One application is if you want two objects to | |
work with the same pseudorandom sequence but don't particularly | |
want to generate them in advance, or to replicate results after | |
serializing and de-serializing an object. | |
By David Warde-Farley, dwf at cs.toronto.edu, January 2010. | |
Released under BSD license. | |
""" |
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 | |
def sample_pf_ball(p,b): | |
""" | |
Samples N binary variables using the product form distribution given in | |
the vector b (of length N), where b[n] is the probability that s[n]=1. | |
However, only K variables may on at a time, where K is the length of | |
vector b minus 1, and b[k] is a distribution that biases the number of | |
variables set to 1. | |
% |
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 python | |
""" | |
NumPy implementation of the classic 'four regions' benchmark. | |
By David Warde-Farley -- user AT cs dot toronto dot edu (user = dwf) | |
Redistributable under the terms of the 3-clause BSD license | |
(see http://www.opensource.org/licenses/bsd-license.php for details) | |
""" | |
import numpy as np |
OlderNewer