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
#!/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
# Copyright Mathieu Blondel December 2011 | |
# License: BSD 3 clause | |
import numpy as np | |
import pylab as pl | |
from sklearn.base import BaseEstimator | |
from sklearn.utils import check_random_state | |
from sklearn.cluster import MiniBatchKMeans | |
from sklearn.cluster import KMeans as KMeansGood |
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 |
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 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'} |
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
#!/bin/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
# Inspired from https://gist.github.com/faleev/3435377 | |
# Remove any existing packages: | |
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
# Get the dependencies (Ubuntu Server or headless users): | |
sudo apt-get update |
OlderNewer