神经网络结构设计 不一定是第一层神经元是输入维度数

def get_model(input_dim=33):
    # Build neural network   
    net = tflearn.input_data(shape=[None, input_dim])
    net = batch_normalization(net)
    #net = tflearn.fully_connected(net, input_dim) #去掉这层的话 精度95+,如果加上精度很难上95%
    net = tflearn.fully_connected(net, 128, activation='tanh')
    net = dropout(net, 0.5)
    net = tflearn.fully_connected(net, 2, activation='softmax')
    net = tflearn.regression(net, optimizer='sgd',
                     loss='categorical_crossentropy', name='target') #  optimizer='sgd'
    # Define model
    model = tflearn.DNN(net)
    #filename = 'CC_model_999.tflearn'
    #model.load(filename)
    #print filename + " loaded OK"
    return model


猜你喜欢

转载自www.cnblogs.com/bonelee/p/9084741.html