예제 #1
0
파일: mnist_prob.py 프로젝트: surban/ml
from ml.apps.rbm import mnist_rbm_config as cfg
import ml.rbm.util as rbmutil
from ml.rbm.rbm import RestrictedBoltzmannMachine


# numeric overflow handling
#np.seterr(all='raise')
#gp.acceptable_number_types = 'no nans or infs'

# parameters
epoch = cfg.epochs - 1
#epoch = 9
use_ruslan = False

# load dataset
X, TX = rbmutil.load_mnist(False)

# load ruslan's training set
mdata = scipy.io.loadmat("mnist.mat")
X = gp.as_garray(mdata['fbatchdata'])

# enter output directory
rbmutil.enter_rbm_plot_directory("mnist", cfg.n_hid, cfg.use_pcd, cfg.n_gibbs_steps,
                                 "prob.txt", clean=False)

# Build RBM
rbm = RestrictedBoltzmannMachine(0, cfg.n_vis, cfg.n_hid, 0) 

# load Ruslan's RBM
if use_ruslan:
    print "Loading Ruslan's ml.rbm..."
예제 #2
0
파일: mnist_rbm_pl.py 프로젝트: surban/ml
import ml.common.util as util
import ml.rbm.util as rbmutil

from ml.rbm.rbm import RestrictedBoltzmannMachine

# numeric overflow handling
#np.seterr(all='raise')
#gp.acceptable_number_types = 'no nans or infs'

# parameters
epoch = 14
do_sampling = True

# load dataset
X, VX, TX = rbmutil.load_mnist()

# enter output directory
rbmutil.enter_rbm_plot_directory("mnist", cfg.n_hid, cfg.use_pcd, cfg.n_gibbs_steps,
                                 clean=False)

# Build RBM
rbm = RestrictedBoltzmannMachine(0, cfg.n_vis, cfg.n_hid, 0) 
rbmutil.load_parameters(rbm, "weights-%02i.npz" % epoch)
#rbmutil.load_parameters("../../../DeepLearningTutorials/code/rbm_plots/GPU-PCD/weights.npz")
#epoch = 99

# calculate statistics
seen_epoch_samples = 0
pl_bit = 0
pl_sum = 0