Esempio n. 1
0
# @author:Akash
# @package:bayesiandnn

from os import sys, path
sys.path.append(path.dirname(path.dirname( path.abspath(__file__) ) ) )

import numpy as np
import argparse
from neuralnetwork.learning.sgd import *
from dataio.pfileio import PfileIO
from neuralnetwork.DNN import DNN
from datasets import mnist
from datasets import timit


parser = argparse.ArgumentParser(description='setting up hyperparameters by command line ...')
parser.add_argument('--percent', '-p', type=float, default=0.9999)
parser.add_argument('--lr', '-l', type=float, default=0.08)
args = parser.parse_args()
percent = args.percent
lr = args.lr


mnist = mnist.load_mnist_theano('mnist.pkl.gz', percent_data=percent)
# print mnist

rng = np.random.RandomState(1111)
nn = DNN(rng, [100], 784, 10)
bsgd(nn, mnist, epochs=15, batch_size=20, lr=lr)

Esempio n. 2
0
import numpy as np
from neuralnetwork.learning.sgd import *
from neuralnetwork.DNN import DNN
from neuralnetwork.LadderAE import LadderAE
from theano.tensor.shared_randomstreams import RandomStreams
from datasets import mnist
from datasets import timit


mnist = mnist.load_mnist_theano('mnist.pkl.gz')
print mnist

train_set_x, train_set_y = mnist[0]
valid_set_x, valid_set_y = mnist[1]
test_set_x, test_set_y = mnist[2]

numpy_rng = np.random.RandomState(1111)
theano_rng = RandomStreams(numpy_rng.randint( 2**30 ))

train_x_label = train_set_x[:20000,:]
train_y_label = train_set_y[:20000]
train_x_unlabel = train_set_x[20000:30000,:] 

LadderNetwork = LadderAE(rng, train_x_label, train_x_unlabel, train_y_label, [784, 500, 500, 100, 50, 10], )

# nn = DNN(rng, [3096, 3096], 784, 10)
bsgd(nn, mnist, epochs=40)

Esempio n. 3
0
from os import sys, path
sys.path.append(path.dirname(path.dirname( path.abspath(__file__) ) ) )

import numpy as np
from neuralnetwork.learning.sgd import *
from neuralnetwork.DNN import DNN 
from neuralnetwork.SdA import SdA
from datasets import mnist
from datasets import timit
from theano.tensor.shared_randomstreams import RandomStreams 



BATCH_SIZE = 700
NUM_EPOCHS = 40
mnist_data = mnist.load_mnist_theano('mnist.pkl.gz', percent_data=0.1)
mnist_full = mnist.load_mnist_theano('mnist.pkl.gz', percent_data=1.0)

print mnist
# train_set_x, train_set_y = mnist_data[0]
valid_set_x, valid_set_y = mnist_data[1]
test_set_x, test_set_y = mnist_data[2]

train_set_x, train_set_y = mnist_full[0]

numpy_rng = np.random.RandomState(1111)

theano_rng = RandomStreams(numpy_rng.randint( 2**30 ))

# nn_ae = DNN(numpy_rng, [1024, 1024], 429, 144)
# configuration for mnist