コード例 #1
0
def test_mlp():
    mlp.test_mlp(n_epochs=1)
コード例 #2
0
ファイル: teste.py プロジェクト: selaht7/mlp_rp
x = T.scalar()
y = T.scalar()

z = x+y

w = z*x

a = T.sqrt(5)
b = T.exp(a)
c = a ** b
d = T.log(c)

num1 = input();
num2 = input();

v = T.dvector()

f2 = function([x, y], x + y)

hello_world_op = printing.Print('aaaa')
printed_vetor = hello_world_op(v)
f = function([v], printed_vetor)
r = f([num1, num2])
m = f2(num1, num2)

import mlp
print ('testendo mlp')
mlp.test_mlp()
# treino 80 teste 20

print m
コード例 #3
0
def test_mlp():
    mlp.test_mlp(n_epochs=1)
コード例 #4
0
def test_mlp():
    t0=time.time()
    mlp.test_mlp(n_epochs=5)
    print >> sys.stderr, "test_mlp took %.3fs expected 118s in our buildbot"%(time.time()-t0)
コード例 #5
0
ファイル: basic.py プロジェクト: 5haggy/SVHN
from scipy.io import loadmat as load
import numpy as np
import matplotlib.pyplot as plt

import mlp
from preprocess import Preprocess

(x_train, y_train) = Preprocess(
    load('train_32x32.mat')).rgb2gray().standarize().scale().flatten().get()

(x_test, y_test) = Preprocess(
    load('test_32x32.mat')).rgb2gray().standarize().scale().flatten().get()

(x_valid, y_valid) = (x_train[math.floor(0.8 * len(x_train)):, :],
                      y_train[math.floor(0.8 * len(y_train)):, :])
(x_train, y_train) = (x_train[:math.floor(0.8 * len(x_train)), :],
                      y_train[:math.floor(0.8 * len(y_train)), :])

print(x_train.shape[0], 'train samples')
print(x_valid.shape[0], 'validation samples')
print(x_test.shape[0], 'test samples')

(name, model) = mlp.create_mlp(1024, 0, ('relu', 512, 0))

mlp.train_mlp(model, 50, x_train, y_train, x_valid, y_valid)
mlp.test_mlp(model, x_test, y_test)

w = np.squeeze(model.layers[0].get_weights())
hw = w[0].T
plot_weights(hw, 32)