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 import * | |
min=10000; max=min*100 | |
s= (min+max)/2 | |
while True: | |
if max - min < 2: break | |
avg= (min+max)/2 | |
try: | |
m=zeros((s,s)) | |
del m |
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 math import log | |
log2= lambda x:log(x,2) | |
from scipy import histogram, digitize, stats, mean, std | |
from collections import defaultdict | |
def conditional_entropy(x, y): | |
""" | |
x: vector de numeros reales | |
y: vector de numeros enteros |
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 import asarray | |
from random import gauss, randint | |
def test(): | |
x= asarray([gauss(0,1) for i in range(1000)]) | |
y1= asarray([int(e>0) for e in x]) | |
y2= asarray([randint(0,1) for e in x]) | |
hx, bx= histogram(x, bins=x.size/10, density=True) | |
dx= digitize(x,bx) |
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 math import log | |
log2= lambda x:log(x,2) | |
from scipy import histogram, digitize, stats, mean, std | |
from collections import defaultdict | |
def mutual_information(x,y): | |
return entropy(y) - conditional_entropy(x,y) | |
def conditional_entropy(x, y): | |
""" |
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 import asarray | |
from random import gauss, randint | |
def test(): | |
x= asarray([gauss(0,1) for i in range(1000)]) | |
y1= asarray([int(e>0) for e in x]) | |
y2= asarray([randint(0,1) for e in x]) | |
hx, bx= histogram(x, bins=x.size/10, density=True) | |
dx= digitize(x,bx) | |
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
X ~ N(0,1) | |
y1 = 1 <=> x > 0 | |
y2 = 1 con probabilidad 0.5 | |
I(y1;x) = H(X) - H(X|Y1) = 0.97 | |
I(y1;x) = H(Y1) - H(Y1|X) = 0.97 | |
I(y2;x) = H(X) - H(X|Y2) = 0.08 | |
I(y2;x) = H(Y2) - H(Y2|X) = 0.08 |
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 shutil | |
from optparse import OptionParser | |
import sys | |
import functools | |
import re | |
import subprocess | |
import os | |
READELF = '/usr/bin/readelf' | |
def get_dependencies(fname, skip_patterns): |
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 tempfile import mktemp | |
import shutil | |
class safe_write(object): | |
def __init__(self, fname): | |
self.fname = fname | |
self.tmp_fname = mktemp() | |
def __enter__(self): | |
self.stream = open(self.tmp_fname, 'w') |
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
with safe_write('delete_me') as f: | |
f.write('some contents') | |
with safe_write('delete_me') as f: | |
1/0 | |
# delete_me contents still are "some contents" |
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Aumentos inflacionarios" | |
] | |
}, | |
{ |
OlderNewer