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
# Illustrates why log-sums are better than direct sums for probability integrals | |
# when probabilities are initially computed on the log scale | |
import pymc | |
import numpy | |
lp_big = numpy.random.normal(loc=0,scale=2,size=1000) | |
print numpy.log(numpy.mean(numpy.exp(lp_big))) | |
print pymc.flib.logsum(lp_big)-numpy.log(len(lp_big)) |
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 pylab as pl | |
import pymc as pm | |
Tau_test = np.matrix([[ 209.47883244, 10.88057915, 13.80581557], | |
[ 10.88057915, 213.58694978, 11.18453854], | |
[ 13.80581557, 11.18453854, 209.89396417]]) | |
C_test = Tau_test.I |
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 __future__ import division | |
import numpy as np | |
# A boat is a dict with keys | |
# mass, center_of_mass, cm_depth, front_depth, back_depth, pitch, length, width | |
# units are radians (angles), meters (depths and lengths), tons (mass) | |
# Boats are idealized as rectangular prisms | |
water_density = 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 | |
import pymc | |
from pymc import gp | |
from pymc.gp.cov_funs import matern,gaussian | |
from pylab import * | |
# Load some data generated from a GP with mean=0, scale=1, amp=1 | |
xdata,ydata = loadtxt('train.txt', unpack=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 | |
import numpy as npy | |
from pymc.gp import Mean, Covariance, Realization, observe, plot_envelope, NearlyFullRankCovariance, FullRankCovariance | |
from pymc.gp.cov_funs import matern #, thinplate1d | |
import matplotlib | |
matplotlib.rcParams['axes.facecolor']=[1,1,1] | |
__all__ = ['surface_mean', 'M', 'C'] | |
def surface_mean(x, val): | |
"""docstring for parabolic_fun""" |
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 pymc as pm | |
import numpy as np | |
# FIXME: Need to store duplicates too, when jumps are rejected. That means some mechanism | |
# for making sure the history is full-rank needs to be employed. | |
class HistoryCovarianceStepper(pm.StepMethod): | |
_state = ['n_points','history','tally','verbose'] | |
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 copy import copy | |
import theano as th | |
import theano.tensor as T | |
def isshared(node): | |
"Is there a better way to do this?" | |
return hasattr(node, 'update') | |
def unpack_nodes(expr): | |
""" |
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 scipy.sparse import linalg | |
import numpy as np | |
import map_utils | |
def dim2w(dim): | |
return np.arange(-np.ceil((dim-1)/2.), np.floor((dim-1)/2.)+1) | |
class fractional_modified_laplacian(linalg.LinearOperator): | |
def __init__(self, dims, kappa, alpha): |
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 | |
from theano import tensor as T | |
import theano | |
x = T.dvector('x') | |
z = T.dscalar('z') | |
y = T.sum(T.cos(x*z)) | |
x_test = np.random.normal(size=10) |
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 | |
# | |
# template script for generating container for LXC | |
# with username and password 'sense' | |
# and an ssh key for the root user. | |
# | |
# This script consolidates and extends the existing lxc ubuntu scripts | |
# |
OlderNewer