Example #1
0
######  Set global Theano config  #######
import os
t_flags = "mode=FAST_RUN,device=cpu,floatX=float32, optimizer='fast_run', allow_gc=False"
print("Theano Flags: " + t_flags)
os.environ["THEANO_FLAGS"] = t_flags

######         Imports          ######
import numpy as np
import time
from past.builtins import xrange
import recnet
from .util import edit_distance

### 1. Step: Create new model
rn = recnet.rnnModel()

### 2. Step: Define parameters
rn.parameter["train_data_name"] = "numbers_image_train.klepto"
rn.parameter["valid_data_name"] = "numbers_image_valid.klepto"
rn.parameter["data_location"] = "data_set/"
rn.parameter["batch_size"] = 1

rn.parameter["net_size"] = [9, 10, 10 + 1]
rn.parameter["net_unit_type"] = ['input', 'conv', 'softmax']
rn.parameter["net_act_type"] = ['-', 'tanh', '-']
rn.parameter["net_arch"] = ['-', 'bi', 'ff']

rn.parameter["random_seed"] = 211
rn.parameter["epochs"] = 30
rn.parameter["learn_rate"] = 0.001
Example #2
0
######  Set global Theano config  #######
import os
t_flags = "mode=FAST_RUN,device=cpu,floatX=float32, optimizer='fast_run', allow_gc=False"
print("Theano Flags: " + t_flags)
os.environ["THEANO_FLAGS"] = t_flags


######         Imports          ######
import numpy as np
import time
from past.builtins import xrange
import recnet
from .util import edit_distance

### 1. Step: Create new model
rn = recnet.rnnModel()

### 2. Step: Define parameters
rn.parameter["train_data_name"] = "numbers_image_train.klepto"
rn.parameter["valid_data_name"] = "numbers_image_valid.klepto"
rn.parameter["data_location"  ] = "data_set/"
rn.parameter["batch_size"     ] = 1

rn.parameter["net_size"       ] = [      9,      10,      10+1]
rn.parameter["net_unit_type"  ] = ['input',  'conv', 'softmax']
rn.parameter["net_act_type"   ] = [    '-',  'tanh',       '-']
rn.parameter["net_arch"       ] = [    '-',    'bi',      'ff']

rn.parameter["random_seed"    ] = 211
rn.parameter["epochs"         ] = 30
rn.parameter["learn_rate"     ] = 0.001