Example #1
0
def main():
    n = 100
    dim = 3
    alpha = .5
    aff = np.random.randn(dim, dim)
    x = np.dot(np.random.randn(n, dim), aff)
    igmm = IMM(alpha, dim)
    igmm.set_priors(x)

    # warming
    igmm.sample(x, niter=100, kfold=10)
    print 'number of components: ', igmm.k
    
    #
    print 'number of components: ', igmm.k

    if dim<3:
        from gmm import plot2D
        plot2D(x, igmm, verbose=1)
    return igmm 
Example #2
0
def main():
    """ Illustrative example of the behaviour of imm
    """
    n = 100
    dim = 2
    alpha = .5
    aff = np.random.randn(dim, dim)
    x = np.dot(np.random.randn(n, dim), aff)
    igmm = IMM(alpha, dim)
    igmm.set_priors(x)

    # warming
    igmm.sample(x, niter=100, kfold=10)
    print('number of components: ', igmm.k)

    #
    print('number of components: ', igmm.k)

    if dim < 3:
        from gmm import plot2D
        plot2D(x, igmm, verbose=1)
    return igmm
Example #3
0
File: imm.py Project: sashka/nipy
def main():
    """ Illustrative example of the behaviour of imm
    """
    n = 100
    dim = 2
    alpha = .5
    aff = np.random.randn(dim, dim)
    x = np.dot(np.random.randn(n, dim), aff)
    igmm = IMM(alpha, dim)
    igmm.set_priors(x)

    # warming
    igmm.sample(x, niter=100, kfold=10)
    print 'number of components: ', igmm.k

    #
    print 'number of components: ', igmm.k

    if dim < 3:
        from gmm import plot2D
        plot2D(x, igmm, verbose=1)
    return igmm