コード例 #1
0
ファイル: figures.py プロジェクト: enobayram/MHFlib
assign(variancesMat, [variances[0],variances[1],2]);

result = GH3list();

mhf = MultiHypDist3();

split(original, result, variancesMat, table);

[x,y] = [r*cos(theta), r*sin(theta)]

figure(5)
hold(False)
Orig = plot(xorig,yorig)
hold(True)
for gh in result:
    mean = pyArray(gh.mean)
    rotGh = cholesky(pyArray(gh.cov))
    [xgh,ygh] = rotate(x,y,rotGh[0:2,0:2])
    [xghm, yghm] = [xgh+mean[0], ygh+mean[1]]
    plot(xghm,yghm, color='green')
ylim([-limit,limit])
xlim([-limit,limit])
legend([OrigI,MaxI],["Original","Components"])
grid(True)

steps = 100


plotGaussian(original,[0,1],limit,steps,6)
plotGaussians(result,[0,1], limit, steps, 7, 0.)
コード例 #2
0
ファイル: plotdist.py プロジェクト: enobayram/MHFlib
# -*- coding: utf-8 -*-
"""
Created on Fri Mar  9 15:56:15 2012

@author: eba
"""

from MHFPython import *
from plotGaussians import *
from plotLines import *

mhd = MultiHypDist3();
mhd.read('dists/dist3');

plotGaussians(mhd.GHlist,[0,1], 3.,80.,5, 0)
plotLines();
コード例 #3
0
ファイル: uniformSplit.py プロジェクト: enobayram/MHFlib
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 27 17:24:31 2012

@author: eba
"""

from numpy import *
from scipy import *
from matplotlib.pyplot import *
from MHFPython import *
from plotGaussians import *

mean = Matrix31()
assign(mean,[0,0,0])
widths = Matrix31()
assign(widths,[20,20,1])

result = GH3list()

maxVars = Matrix31()
assign(maxVars,[1,1,1])

table = SplitTable1('tables/kl1e-1uniftable')

uniformSplit(mean,maxVars,result,maxVars,table)

plotGaussians(result,[0,1],1,100.0,0,0)
コード例 #4
0
ファイル: demo.py プロジェクト: enobayram/MHFlib
maxa = z.max()
#maxa = plotGaussian(original,[0,1],limit,steps,1)

table = SplitTable1(); #use the default table, generated for a max kl divergence of 0.01

variances = MeanMatrix();
assign(variances, [0.1,0.1,0.02]);

result = GH3list();

mhf = MultiHypDist3();
singlehyp = MultiHypDist3();

split(original, result, variances, table);

plotGaussians(result,[0,1], limit, steps, 4, maxa)

if(not os.path.exists('./figures')):
    os.mkdir('figures')

savefig('figures/initial')


plotvar = 2;
#1D plot of the table entries
lim1d = sqrt(plotvar)*4;
x = arange(-lim1d,lim1d,lim1d/500)
#y = 1/sqrt(2*pi*originalVar)*exp(-1/2*(x*x)/originalVar)
y = 1/sqrt(2*pi*plotvar)*exp(-x*x/(2*plotvar))
fig=figure(3)
hold(False)