示例#1
0
def train_dbn(dbn_weights, training_data, learning_rate=0.1, max_epochs=1):
    # train layer by layer
    # fully train one layer, then train the next, until all are trained
    for idx, weight in enumerate(dbn_weights):
        if idx == 0:  # first layer training
            rbm.train(weight, training_data, learning_rate, max_epochs)
            continue

        else:
            training_data = rbm.get_states(rbm.construct(dbn_weights[idx - 1], training_data))

        rbm.train(weight, training_data, learning_rate, max_epochs)
    return dbn_weights
示例#2
0
def train_dbn(dbn_weights, training_data, learning_rate = .1, max_epochs = 1):
    #train layer by layer
    #fully train one layer, then train the next, until all are trained
    for idx, weight in enumerate(dbn_weights):
        if idx == 0: #first layer training
            rbm.train(weight, training_data, learning_rate, max_epochs)
            continue

        else:
            training_data = rbm.get_states(rbm.construct(dbn_weights[idx-1], training_data))

        rbm.train(weight, training_data,learning_rate, max_epochs)
    return dbn_weights
示例#3
0
def construct(weights, vis_states):
    for weight in weights:
        vis_states = rbm.construct(weight, vis_states)
    return vis_states
示例#4
0
def construct(weights, vis_states):
    for weight in weights:
        vis_states = rbm.construct(weight, vis_states)
    return vis_states