예제 #1
0
def test_ml_updates():
    r = ssrbm.ssRBM(n_h=nh,
                    n_v=nv,
                    bw_h=bwh,
                    iscales={
                        'Wv': 0.1,
                        'hbias': 0.,
                        'alpha': 1.,
                        'mu': 0.,
                        'beta': 1.
                    },
                    compile=True,
                    batch_size=batch_size,
                    sp_weight={'h': 0.},
                    sp_targ={'h': 0.},
                    sparse_hmask=sparse_masks.SparsityMask.unfactored_g(
                        nh, nh, bwh, bwh),
                    parametrize_sqrt_precision=False,
                    l1={
                        'Wh': 0.,
                        'Wv': 0.
                    },
                    l2={
                        'Wh': 0.,
                        'Wv': 0.
                    })

    x = numpy.random.rand(batch_size, nv)
    r.batch_train_func(x)
예제 #2
0
def quick_alloc():
    r = ssrbm.ssRBM(n_h=nh,
                    n_v=nv,
                    bw_h=bwh,
                    iscales={
                        'Wv': 0.1,
                        'hbias': 0.,
                        'alpha': 1.,
                        'mu': 0.,
                        'beta': 1.
                    },
                    compile=False,
                    batch_size=batch_size,
                    sp_weight={'h': 0.},
                    sp_targ={'h': 0.},
                    sparse_hmask=sparse_masks.SparsityMask.unfactored_g(
                        nh, nh, bwh, bwh),
                    parametrize_sqrt_precision=False,
                    l1={
                        'Wh': 0.,
                        'Wv': 0.
                    },
                    l2={
                        'Wh': 0.,
                        'Wv': 0.
                    })
    r.Wv.set_value(Wv)
    r.hbias.set_value(hbias)
    r.mu.set_value(mu)
    r.alpha.set_value(alpha)
    r.beta.set_value(beta)
    return r
예제 #3
0
def test_ml_updates():
    r = ssrbm.ssRBM(n_h=nh, n_v=nv, bw_h=bwh,
            iscales={'Wv': 0.1, 'hbias':0., 'alpha':1., 'mu':0., 'beta':1.},
            compile=True, batch_size=batch_size,
            sp_weight={'h':0.},
            sp_targ={'h':0.},
            sparse_hmask = sparse_masks.SparsityMask.unfactored_g(nh,nh,bwh,bwh),
            parametrize_sqrt_precision = False,
            l1={'Wh':0.,'Wv':0.},
            l2={'Wh':0.,'Wv':0.})

    x = numpy.random.rand(batch_size, nv)
    r.batch_train_func(x)
예제 #4
0
def quick_alloc():
    r = ssrbm.ssRBM(n_h=nh, n_v=nv, bw_h=bwh,
            iscales={'Wv': 0.1, 'hbias':0., 'alpha':1., 'mu':0., 'beta':1.},
            compile=False, batch_size=batch_size,
            sp_weight={'h':0.},
            sp_targ={'h':0.},
            sparse_hmask = sparse_masks.SparsityMask.unfactored_g(nh,nh,bwh,bwh),
            parametrize_sqrt_precision = False,
            l1={'Wh':0.,'Wv':0.},
            l2={'Wh':0.,'Wv':0.})
    r.Wv.set_value(Wv)
    r.hbias.set_value(hbias)
    r.mu.set_value(mu)
    r.alpha.set_value(alpha)
    r.beta.set_value(beta)
    return r