sudo apt-get install debootstrap schroot
CHROOT=/tmp/saucy-i386; mkdir -p $CHROOT; sudo debootstrap --arch=i386 --include=python-pandas,sudo,wget --components=main,universe,multiverse saucy $CHROOT http://debian.lcs.mit.edu/ubuntu
echo -e "[saucy-i386]\ndescription=Ubuntu saucy i386 architecture\ndirectory=$CHROOT\ntype=directory\nusers=$USER\nroot-groups=root\n" | sudo bash -c 'cat - > /etc/schroot/chroot.d/saucy-i386'
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
""" | |
Frisch-Waugh-Lovell Theorem. | |
In a multiple regression, the effect of any single covariate can be obtained | |
by removing the effects of the other covariates from both the dependent and | |
independent variables. | |
""" | |
import numpy as np | |
import statsmodels.api as sm |
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
library(fpp) | |
data(usmelec) | |
write.csv(as.data.frame(list(date=as.Date(usmelec), usmelec=coredata(usmelec))), "usmelec.csv", row.names=FALSE) |
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
% stochastic independence | |
\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}} | |
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}} | |
% conditional probability pipe | |
\mid |
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
export BLAS=/home/skipper/.local/lib/libopenblas.a | |
export LAPACK=/home/skipper/.local/lib/libopenblas.a | |
pip install numpy | |
pip install scipy | |
pip install nose | |
pip install patsy | |
pip install Cython | |
pip install pandas |
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 28 columns, instead of 11. in line 9.
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
Origin,Destination,Data,Oi,Dj,Dij,Offset,beta,OrigAT11,OrigAT12,OrigAT13,OrigAT21,OrigAT22,OrigAT31,OrigAT32,OrigAT33,OrigAT34,DestAT11,DestAT12,DestAT13,DestAT21,DestAT22,DestAT31,DestAT32,DestAT33,DestAT34,Oi2007,Dj2007 | |
AT11,AT11,0,4016,5146,9.999999999999994e-301,9.999999999999994e-301,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4320,5452 | |
AT11,AT12,1131,4016,25741,103.00184499999999,1.0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,4320,27169 | |
AT11,AT13,1887,4016,26980,84.204666,1.0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,4320,28710 | |
AT11,AT21,69,4016,4117,220.811933,1.0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,4320,4354 | |
AT11,AT22,738,4016,8634,132.00748000000002,1.0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,4320,9069 | |
AT11,AT31,98,4016,8193,214.51181400000002,1.0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,4320,8577 | |
AT11,AT32,31,4016,4902,246.933305,1.0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,4320,4963 | |
AT11,AT33,43,4016,3952,390.85611,1.0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,4320,3923 | |
AT11,AT34,19,4016,1910,505.08953899999995,1.0,1,0,0,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
import logging | |
for i in range(5): | |
for j in range(10, 15): | |
logger = logging.getLogger("log_{}_{}.log".format(i, j)) | |
handler = logging.FileHandler("log_{}_{}.log".format(i, j)) | |
logger.setLevel(logging.INFO) | |
logger.addHandler(handler) | |
logger.info("I'm on this loop") |
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 urllib2 import urlopen | |
from itertools import chain | |
def scan(url, sep=" ", skiprows=0): | |
f = urlopen(url).readlines()[skiprows:] | |
return map(float, chain(*map(lambda x : x.strip().split(sep), f))) | |
if __name__ == "__main__": | |
url = "http://robjhyndman.com/tsdldata/hurst/precip1.dat" | |
scan(url, 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
N = 2*10**7 | |
chunk_size = 100000 | |
farr1 = 'scratch/arr1' | |
farr2 = 'scratch/arr2' | |
arr1 = np.memmap(farr1, dtype='uint8', mode='w+', shape=(N, 4)) | |
arr2 = np.memmap(farr2, dtype='uint8', mode='w+', shape=(N, 4)) | |
for i in xrange(0, N, chunk_size): |
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
In file included from /home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/ndarraytypes.h:1761:0, | |
from /home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/ndarrayobject.h:17, | |
from /home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/arrayobject.h:4, | |
from mwe.c:346: | |
/home/skipper/.local/lib/python3.3/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] | |
#warning "Using deprecated NumPy API, disable it by " \ | |
^ | |
In file included from /usr/include/python3.3m/pytime.h:6:0, | |
from /usr/include/python3.3m/Python.h:65, | |
from mwe.c:16: |