Esempio n. 1
0
# setting parameters of MLP model
mlp = models.MLP()
mlp.layers = layers
mlp.input_space = some_space

# define weight decay parameters. They depend on the number of layers (there is one parameter fo each layer)
weight_decay_coeffs = yp.parse_weight_decay(mlp)

# define data paths
path = config.data_path

# generate a filename to store the best model
pkl_filename = join(config.path_for_storing, current_time+"example_best.pkl")

# create dictionary with hyper parameters
hyper_params = {'model': yp.parse_to_yaml(mlp), 'path': yp.parse_to_yaml(path),
                'weight_decay_coeffs': weight_decay_coeffs, 'pkl_filename': pkl_filename}

# obtaining the yaml skelton
with open(config.yaml_skelton_path) as f:
    default_string = f.read()

# filling the yaml skelton with hyperparameters
yaml_string = default_string % hyper_params

generated_yaml_path = join(config.path_for_storing, current_time+'generated_yaml.yaml')
with open(generated_yaml_path, 'w') as g:
    g.write(yaml_string)

# creating the model based on a yaml
model = yaml_parse.load(yaml_string)
Esempio n. 2
0
def t3():
    tup = (models.MLP(), models.Linear(), models.TanhConvNonlinearity(), models.SoftmaxPool())
    return parse_to_yaml(tup)
Esempio n. 3
0
def t1():
    l = [models.MLP(), models.Linear(), models.TanhConvNonlinearity(), models.SoftmaxPool()]
    return parse_to_yaml(l)
Esempio n. 4
0
def t2():
    d = {'a': models.MLP(), 'b': models.Linear(), 'c': models.TanhConvNonlinearity(), 'd': models.SoftmaxPool()}
    return parse_to_yaml(d)