当前位置: 首页>>代码示例>>Python>>正文


Python NeuralNet.update_learning_rate方法代码示例

本文整理汇总了Python中nolearn.lasagne.NeuralNet.update_learning_rate方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNet.update_learning_rate方法的具体用法?Python NeuralNet.update_learning_rate怎么用?Python NeuralNet.update_learning_rate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nolearn.lasagne.NeuralNet的用法示例。


在下文中一共展示了NeuralNet.update_learning_rate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: CompileNetwork

# 需要导入模块: from nolearn.lasagne import NeuralNet [as 别名]
# 或者: from nolearn.lasagne.NeuralNet import update_learning_rate [as 别名]
def CompileNetwork(l_out, epochs, update, update_learning_rate, objective_l2,
				   earlystopping, patience, batch_size, verbose):
	
    update_fn = getattr(updates, update)
    earlystop = EarlyStopping(patience=patience, verbose=verbose)

    net = NeuralNet(
        l_out,
        max_epochs=epochs,
         
        update=update_fn,
        
        objective_l2=objective_l2,
        
        batch_iterator_train = BatchIterator(batch_size=batch_size),
        batch_iterator_test = BatchIterator(batch_size=batch_size),    
        verbose=verbose,
        on_training_finished = [earlystop.load_best_weights]
    )
    
    if earlystopping == True: 
        net.on_epoch_finished.append(earlystop)
    if update_learning_rate is not None: 
        net.update_learning_rate=update_learning_rate
    

    return net
开发者ID:jacobzweig,项目名称:RCNN_Toolbox,代码行数:29,代码来源:RCNN.py

示例2: createNet

# 需要导入模块: from nolearn.lasagne import NeuralNet [as 别名]
# 或者: from nolearn.lasagne.NeuralNet import update_learning_rate [as 别名]
def createNet(X, Y, ln, loadFile = ""):
    net1 = NeuralNet(
        layers=[  # four layers: two hidden layers
            ('input', layers.InputLayer),
            ('hidden', layers.DenseLayer),
            ('hidden1', layers.DenseLayer),
            ('hidden2', layers.DenseLayer),
            ('hidden3', layers.DenseLayer),
            ('output', layers.DenseLayer),
            ],
        # layer parameters: Best 400 400
        input_shape=(None, numInputs),  # 31 inputs
        hidden_num_units=400,  # number of units in hidden layer
        hidden1_num_units=400,
        hidden2_num_units=400,
        hidden3_num_units=400,
        output_nonlinearity=None,  # output layer uses identity function
        output_num_units=numOutputs,  # 4 outputs
    
        # optimization method:
        update=nesterov_momentum,
        update_learning_rate=ln,
        update_momentum=0.9,
    
        regression=True,  # flag to indicate we're dealing with regression problem
        max_epochs=1500,  # we want to train this many epochs
        verbose=1,
        )
    #if (loadFile != ""):
        #net1.load_params_from(loadFile)
    net1.max_epochs = 50
    net1.update_learning_rate = ln;

    return net1
开发者ID:tmoldwin,项目名称:NNGen,代码行数:36,代码来源:Lasagne.py


注:本文中的nolearn.lasagne.NeuralNet.update_learning_rate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。