Skip to content

Instantly share code, notes, and snippets.

@lucastheis
lucastheis / crossvalidation.ipynb
Created August 29, 2015 08:44
Bias of standard error in leave-one-out cross-validation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lucastheis
lucastheis / Removing skewness.ipynb
Created February 23, 2015 08:43
Removing skewness
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lucastheis
lucastheis / gram_matrix.py
Last active August 29, 2015 14:25
Gram matrix in Theano
import theano as th
import theano.tensor as tt
def gaussian_kernel(x, y, sigma=1.):
return tt.exp(-tt.sum(tt.square(x - y)) / sigma**2)
def gram_matrix(X, Y, kernel):
M = X.shape[0]
N = Y.shape[0]
from multiprocessing import Process, Pool, Queue
def f(q0):
for i in range(100):
q0.put(i)
def g(q0, q1):
while True:
q1.put(q0.get())
#ifndef GSM_H
#define GSM_H
#include "Eigen/Core"
#include "distribution.h"
#include "exception.h"
#include <iostream>
#include <cmath>
using namespace Eigen;
@lucastheis
lucastheis / scalars.ipynb
Last active November 12, 2015 15:57
Don't mix integers with floats in Theano.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
from matplotlib.pyplot import *
from numpy import *
from numpy.random import *
def autocorr(X, N, d=1):
"""
#!/usr/bin/env python
"""
Manage and display experimental results.
"""
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
__author__ = 'Lucas Theis <lucas@theis.io>'
__docformat__ = 'epytext'
__version__ = '0.4.3'
@lucastheis
lucastheis / marginal_likelihood.py
Last active December 20, 2015 07:39
Log-normal vs. normal test.
__author__ = 'Lucas Theis <lucas@theis.io>'
__license__ = 'MIT License <http://www.opensource.org/licenses/mit-license.php>'
import sys
from numpy import *
from numpy.random import *
from matplotlib.pyplot import *
from scipy.special import gammaln
from scipy.stats import norm, invgamma
import sys
from numpy import *
from numpy.random import *
from matplotlib.pyplot import *
from scipy.stats import *
p17 = .05
p18 = .03