示例#1
0
def build_mlps(kind, PV,true_out ,path, datasets, name):
    conf          = read_parser(path)
    learning_rate = float( conf['parm']['learning_rate'])
    L1_reg        = float( conf['parm']['l1_reg'])
    L2_reg        = float( conf['parm']['l2_reg'])
    n_epochs      = int(   conf['parm']['n_epochs'])
    batch_size    = int(   conf['parm']['batch_size'])
    pre_run       = int(   conf['parm']['pre_run'])
    n_in          = int(   conf['input_layer']['input_num'])
    n_hidden      = []
    h_activation  = []
    n_out         = int(   conf['out_layer']['out_num'])

    for i in xrange(len(conf)):
        tem = 'hidden_layer_' + str(i)
        if tem in conf.keys():
            n_hidden.append(int(conf[tem]['hidden_num']))
            h_activation.append(int(conf[tem]['activation']))

    out = test_mlp(pre_run = pre_run,               
                   kind = kind,                 \
                   PV =PV,                      \
                   true_out = true_out,         \
                   name = name,                 \
                   learning_rate=learning_rate, \
                   L1_reg=L1_reg,               \
                   L2_reg=L2_reg,               \
                   n_epochs=n_epochs,           \
                   datasets=datasets,           \
                   batch_size=batch_size,       \
                   n_hidden=n_hidden,           \
                   h_activation = h_activation, \
                   n_out=n_out)
    return out
示例#2
0
def build_mlps(kind, PV, true_out, path, datasets, name):
    conf = read_parser(path)
    learning_rate = float(conf['parm']['learning_rate'])
    L1_reg = float(conf['parm']['l1_reg'])
    L2_reg = float(conf['parm']['l2_reg'])
    n_epochs = int(conf['parm']['n_epochs'])
    batch_size = int(conf['parm']['batch_size'])
    pre_run = int(conf['parm']['pre_run'])
    n_in = int(conf['input_layer']['input_num'])
    n_hidden = []
    h_activation = []
    n_out = int(conf['out_layer']['out_num'])

    for i in xrange(len(conf)):
        tem = 'hidden_layer_' + str(i)
        if tem in conf.keys():
            n_hidden.append(int(conf[tem]['hidden_num']))
            h_activation.append(int(conf[tem]['activation']))

    out = test_mlp(pre_run = pre_run,
                   kind = kind,                 \
                   PV =PV,                      \
                   true_out = true_out,         \
                   name = name,                 \
                   learning_rate=learning_rate, \
                   L1_reg=L1_reg,               \
                   L2_reg=L2_reg,               \
                   n_epochs=n_epochs,           \
                   datasets=datasets,           \
                   batch_size=batch_size,       \
                   n_hidden=n_hidden,           \
                   h_activation = h_activation, \
                   n_out=n_out)
    return out
示例#3
0
def build_cnn(path):
    conf = read_parser(path)
    learning_rate = float(conf['parm']['learning_rate'])
    n_epochs = int(conf['parm']['n_epochs'])
    batch_size = int(conf['parm']['batch_size'])
    input_layer = conf['input_layer']
    ConvPool = {}
    hidden = {}
    lr_layer = conf['lr_layer']

    for i in xrange(len(conf)):
        tem = 'ConvPool' + str(i)
        if tem in conf.keys():
            ConvPool[tem] = conf[tem]
    print ConvPool
    for i in xrange(len(conf)):
        tem = 'hidden_layer_' + str(i)
        if tem in conf.keys():
            hidden[tem] = conf[tem]
    print hidden
    """
示例#4
0
def build_cnn(path):
    conf          = read_parser(path)
    learning_rate = float(    conf['parm']['learning_rate'])
    n_epochs      = int(      conf['parm']['n_epochs'])
    batch_size    = int(      conf['parm']['batch_size'])
    input_layer   =           conf['input_layer']
    ConvPool      = {}
    hidden        = {}
    lr_layer      =           conf['lr_layer']

    for i in xrange(len(conf)):
        tem = 'ConvPool' + str(i)
        if tem in conf.keys():
            ConvPool[tem] = conf[tem]
    print ConvPool
    for i in xrange(len(conf)):
        tem = 'hidden_layer_' + str(i)
        if tem in conf.keys():
            hidden[tem]  = conf[tem]
    print hidden
    
    """
示例#5
0
def build_dbn(kind, PV,true_out ,path, datasets, name):
    conf          = read_parser(path)
    finetune_lr   = float(    conf['parm']['finetune_lr'])
    pretrain_lr   = float(    conf['parm']['pretrain_lr'])
    pretraining_epochs = int( conf['parm']['pretraining_epochs'])
    training_epochs = int(    conf['parm']['training_epochs'])
    batch_size    = int(      conf['parm']['batch_size'])
    k             = int(      conf['parm']['k'])
    pre_run       = int(   conf['parm']['pre_run'])
    input_num     = int(      conf['input_layer']['input_num'])
    n_hidden      = []
    h_activation  = []
    out_num       = int(      conf['out_layer']['out_num'])
    for i in xrange(len(conf)):
        tem = 'hidden_layer_' + str(i)
        if tem in conf.keys():
            n_hidden.append(int(conf[tem]['hidden_num']))
            h_activation.append(int(conf[tem]['activation']))
    print n_hidden
    out = test_DBN(pre_run = pre_run,
                   kind = kind,                          \
                   PV =PV,                               \
                   true_out = true_out,                  \
                   path = path,                          \
                   k = k,                                \
                   name = name,                          \
                   finetune_lr=finetune_lr,              \
                   pretraining_epochs=pretraining_epochs,\
                   training_epochs=training_epochs,      \
                   pretrain_lr = pretrain_lr,            \
                   datasets=datasets,                    \
                   batch_size=batch_size,                \
                   hidden_layers_sizes=n_hidden ,        \
                   h_activation  = h_activation ,        \
                   input_num=input_num,                  \
                   out_num=out_num)
    return out
示例#6
0
def build_cnn(kind, PV, true_out, path, datasets, name):
    conf = read_parser(path)
    learning_rate = float(conf['parm']['learning_rate'])
    n_epochs = int(conf['parm']['n_epochs'])
    batch_size = int(conf['parm']['batch_size'])
    pre_run = int(conf['parm']['pre_run'])
    input_layer = conf['input_layer']
    ConvPool = {}
    hidden = {}
    out_layer = conf['out_layer']

    for i in xrange(len(conf)):
        tem = 'ConvPool' + str(i)
        if tem in conf.keys():
            ConvPool[tem] = conf[tem]

    for i in xrange(len(conf)):
        tem = 'hidden_layer_' + str(i)
        if tem in conf.keys():
            hidden[tem] = conf[tem]

    out = cnn( pre_run = pre_run,
               kind = kind,                    \
               PV =PV,                         \
               true_out = true_out,            \
               learning_rate = learning_rate,  \
               n_epochs = n_epochs,            \
               datasets =datasets,             \
               batch_size=batch_size,          \
               path = path ,                   \
               name = name,                    \
               input_layer=input_layer,        \
               hidden=hidden,                  \
               ConvPool=ConvPool,              \
               out_layer=out_layer)
    return out
示例#7
0
def build_cnn(kind, PV,true_out ,path, datasets, name):
    conf          = read_parser(path)
    learning_rate = float(    conf['parm']['learning_rate'])
    n_epochs      = int(      conf['parm']['n_epochs'])
    batch_size    = int(      conf['parm']['batch_size'])
    pre_run       = int(   conf['parm']['pre_run'])
    input_layer   =           conf['input_layer']
    ConvPool      = {}
    hidden        = {}
    out_layer      =           conf['out_layer']

    for i in xrange(len(conf)):
        tem = 'ConvPool' + str(i)
        if tem in conf.keys():
            ConvPool[tem] = conf[tem]

    for i in xrange(len(conf)):
        tem = 'hidden_layer_' + str(i)
        if tem in conf.keys():
            hidden[tem]  = conf[tem]

    out = cnn( pre_run = pre_run,
               kind = kind,                    \
               PV =PV,                         \
               true_out = true_out,            \
               learning_rate = learning_rate,  \
               n_epochs = n_epochs,            \
               datasets =datasets,             \
               batch_size=batch_size,          \
               path = path ,                   \
               name = name,                    \
               input_layer=input_layer,        \
               hidden=hidden,                  \
               ConvPool=ConvPool,              \
               out_layer=out_layer)
    return out