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
#!/usr/bin/env python | |
''' | |
Pure Python implementation of some numerical optimizers | |
Created on Jan 21, 2011 | |
@author Jiahao Chen | |
''' |
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 SPPLayer(lasagne.layers.Layer): | |
def __init__(self, incoming, **kwargs): | |
super(SPPLayer, self).__init__(incoming, **kwargs) | |
# divide by 4 gives 16 patches | |
self.win1 = (int(np.floor(incoming.output_shape[2]/4.0)), int(np.floor(incoming.output_shape[3]/4.0))) | |
self.str1 = (int(np.ceil(incoming.output_shape[2]/4.0)), int(np.ceil(incoming.output_shape[3]/4.0))) | |
# divide by 2 gives 4 patches | |
self.win2 = (int(np.floor(incoming.output_shape[2]/2.0)), int(np.floor(incoming.output_shape[3]/2.0))) |
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
def gaussian_density_batch(x, mean, stddev, correlation, compute_derivatives=False): | |
""" | |
Compute the Gaussian density at x for a 2D normal distribution with parameters mean, stddev, correlation. | |
This works simultaneously on a batch of inputs. The inputs should have dimensions: | |
x.shape = (n, 1, 2) | |
mean.shape = stddev.shape = (n, m, 2) | |
correlation.shape = (n, m, 1) | |
where n*m is the number of different Gaussian density functions that we want to evaluate, on n input points x. | |
So the same input x is plugged into the density for m Gaussian pdfs. (This is convenient for evaluating a |
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
# smidi.py: A simple midi-file library | |
# make a single file version for midi-outfile only. | |
# Original code is from Max M's site here (GPL) | |
# http://www.mxm.dk/products/public/pythonmidi | |
# Modified by korakot, | |
# http://snippets.dzone.com/posts/show/572 | |
""" | |
include source codes from | |
- constants.py |
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 os | |
import requests | |
from bs4 import BeautifulSoup | |
class GSheet(object): | |
base_sheet_url = 'https://spreadsheets.google.com/feeds/worksheets/{0}/private/full' | |
list_worksheet_url = 'https://spreadsheets.google.com/feeds/list/{0}/{{}}/private/full' | |
cell_worksheet_url = 'https://spreadsheets.google.com/feeds/cells/{0}/{{}}/private/full' | |
HTTPheaders = {'content-type': 'application/atom+xml'} |
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 types | |
import tensorflow as tf | |
import numpy as np | |
# Expressions are represented as lists of lists, | |
# in lisp style -- the symbol name is the head (first element) | |
# of the list, and the arguments follow. | |
# add an expression to an expression list, recursively if necessary. | |
def add_expr_to_list(exprlist, expr): |
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
""" | |
Maxout implementation in Theano | |
""" | |
# W,b - Parameters in neural network layer | |
# activation - Activation function | |
# maxoutsize - Number of input neurons to maxout units | |
# Output activation function | |
output = activation(T.dot(input,W) + b) |
OlderNewer