示例#1
0
文件: imm.py 项目: Garyfallidis/nipy
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 
示例#2
0
文件: imm.py 项目: matthew-brett/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
示例#3
0
文件: imm.py 项目: 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