Exemplo n.º 1
0
def draw2dgmm(gmm, show=False, axes=None):

    for comp in gmm.comps:
        draw2dnormal(comp)
Exemplo n.º 2
0
from plot_normal import draw2dnormal
import pylab as pl
import numpy as np
npa = np.array

if False:
    fp = open("faithful.txt")
    data = []
    for line in fp.readlines():
        x,y = line.split()
        data.append([float(x),float(y)])

    data = npa(data)
    pl.scatter(data[:,0],data[:,1])
    x = Normal(2, data=data)
    draw2dnormal(x,show=True,axes=pl.gca())

if True:
    x = Normal(2,mu = np.array([0.1,0.7]), sigma = np.array([[ 0.6,  0.4], [ 0.4,  0.6]]))
    s = x.simulate()
    draw2dnormal(x)
    pl.scatter(s[:,0],s[:,1])
    pl.show()
    print s

if False:
    x = Normal(2,mu = np.array([0.1,0.7]), sigma = np.array([[ 0.6,  0.4], [ 0.4,  0.6]]))
    #draw2dnormal(x,show=True)
    print x
    new = x.condition([0],0.1)
    print new
Exemplo n.º 3
0
import numpy as np

npa = np.array
import pdb

if False:
    fp = open("faithful.txt")
    data = []
    for line in fp.readlines():
        x, y = line.split()
        data.append([float(x), float(y)])

    data = npa(data)
    pl.scatter(data[:, 0], data[:, 1])
    x = Normal(2, data=data)
    draw2dnormal(x, show=True, axes=pl.gca())

if True:
    x = Normal(2,
               mu=np.array([0.1, 0.7]),
               sigma=np.array([[0.6, 0.4], [0.4, 0.6]]))
    s = x.simulate()
    draw2dnormal(x)
    pl.scatter(s[:, 0], s[:, 1])
    pl.show()
    print(s)

if False:
    x = Normal(2,
               mu=np.array([0.1, 0.7]),
               sigma=np.array([[0.6, 0.4], [0.4, 0.6]]))
Exemplo n.º 4
0
def draw2dgmm(gmm, show = False, axes = None):
    
    for comp in gmm.comps:
        draw2dnormal(comp)