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 pymc import * | |
from scipy.stats import norm | |
import pylab as plt | |
# Same model as the tutorial | |
n = 1000 | |
x1 = norm.rvs(0, 1, size=n) | |
x2 = -x1 + norm.rvs(0, 10**-3, size=n) | |
x3 = norm.rvs(0, 1, size=n) |
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
# Jaynes' counter-intuitive equation | |
# 3.59 in PT:TLoS | |
import random | |
random.seed(1) # For experiment reproduction | |
# P(R1|R2) | |
count_reds1 = 0.0 | |
count_total1 = 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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import pymc #2.3 | |
import pylab | |
from scipy.special import binom | |
#Jaynes' PT:TLoS example 4.1 | |
def db(x): # Decibel transform | |
return 10.0*np.log10(x) |
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
# -*- coding: utf-8 -*- | |
import numpy as np | |
import pylab | |
from scipy.special import binom | |
from bayespy.nodes import Categorical, Binomial, Gate, Beta | |
#Jaynes' PT:TLoS example 4.1 | |
def db(x): # Decibel transform | |
return 10.0*np.log10(x) |
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
# -*- coding: utf-8 -*- | |
import numpy as np | |
from scipy.special import binom | |
import random | |
#Jaynes' PT:TLoS exercise 4.4 | |
def db(x): # Decibel transform | |
return 10.0*np.log10(x) |
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
# -*- coding: utf-8 -*- | |
import numpy as np | |
from scipy.special import binom | |
#Jaynes' PT:TLoS exercise 4.2 | |
def db(x): # Decibel transform | |
return 10.0*np.log10(x) | |
def evidence(x): # Equation 4.8 |
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
# -*- coding: utf-8 -*- | |
""" | |
Reproducing the results of Auto-Encoding Variational Bayes by Kingma and Welling | |
With a little help from the code from van Amersfoort and Otto Fabius (https://github.com/y0ast) | |
@author: Pedro Tabacof (tabacof at gmail dot com) | |
""" | |
import random | |
import numpy as np |