本文整理汇总了Python中nolearn.lasagne.NeuralNet.output_hiddenLayer方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNet.output_hiddenLayer方法的具体用法?Python NeuralNet.output_hiddenLayer怎么用?Python NeuralNet.output_hiddenLayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nolearn.lasagne.NeuralNet
的用法示例。
在下文中一共展示了NeuralNet.output_hiddenLayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createSAE
# 需要导入模块: from nolearn.lasagne import NeuralNet [as 别名]
# 或者: from nolearn.lasagne.NeuralNet import output_hiddenLayer [as 别名]
def createSAE(input_height, input_width, X_train, X_out):
encode_size = 200
cnn1 = NeuralNet(layers=[
('input', layers.InputLayer),
('hidden', layers.DenseLayer),
('hiddenOut', layers.DenseLayer),
('output_layer', ReshapeLayer),
],
input_shape=(None, 1, input_width, input_height),
hidden_num_units= 10000,
hiddenOut_num_units= 42000,
output_layer_shape = (([0], -1)),
update_learning_rate=learning_rate,
update_momentum=update_momentum,
update=nesterov_momentum,
train_split=TrainSplit(eval_size=train_valid_split),
# batch_iterator_train=BatchIterator(batch_size=batch_size),
batch_iterator_train=FlipBatchIterator(batch_size=batch_size),
regression=True,
max_epochs=epochs,
verbose=1,
hiddenLayer_to_output=-3)
cnn1.fit(X_train, X_out)
trian_last_hiddenLayer = cnn1.output_hiddenLayer(X_train)
test_last_hiddenLayer = cnn1.output_hiddenLayer(test_x)
cnn2 = NeuralNet(layers=[
('input', layers.InputLayer),
('hidden', layers.DenseLayer),
('output_layer', layers.DenseLayer),
],
input_shape=(None,10000),
hidden_num_units= 3000,
output_layer_num_units = 10000,
update_learning_rate=learning_rate,
update_momentum=update_momentum,
update=nesterov_momentum,
train_split=TrainSplit(eval_size=train_valid_split),
batch_iterator_train=BatchIterator(batch_size=batch_size),
# batch_iterator_train=FlipBatchIterator(batch_size=batch_size),
regression=True,
max_epochs=epochs,
verbose=1,
hiddenLayer_to_output=-2)
trian_last_hiddenLayer = trian_last_hiddenLayer.astype(np.float32)
cnn2.fit(trian_last_hiddenLayer, trian_last_hiddenLayer)
trian_last_hiddenLayer = cnn2.output_hiddenLayer(trian_last_hiddenLayer)
test_last_hiddenLayer = cnn2.output_hiddenLayer(test_last_hiddenLayer)
cnn3 = NeuralNet(layers=[
('input', layers.InputLayer),
('hidden', layers.DenseLayer),
('output_layer', layers.DenseLayer),
],
input_shape=(None,3000),
hidden_num_units= 1000,
output_layer_num_units = 3000,
update_learning_rate=learning_rate,
update_momentum=update_momentum,
update=nesterov_momentum,
train_split=TrainSplit(eval_size=train_valid_split),
batch_iterator_train=BatchIterator(batch_size=batch_size),
# batch_iterator_train=FlipBatchIterator(batch_size=batch_size),
regression=True,
max_epochs=epochs,
verbose=1,
hiddenLayer_to_output=-2)
trian_last_hiddenLayer = trian_last_hiddenLayer.astype(np.float32)
cnn3.fit(trian_last_hiddenLayer, trian_last_hiddenLayer)
trian_last_hiddenLayer = cnn3.output_hiddenLayer(trian_last_hiddenLayer)
test_last_hiddenLayer = cnn3.output_hiddenLayer(test_last_hiddenLayer)
cnn4 = NeuralNet(layers=[
('input', layers.InputLayer),
('hidden', layers.DenseLayer),
('output_layer', layers.DenseLayer),
],
input_shape=(None,1000),
hidden_num_units= 300,
output_layer_num_units = 1000,
update_learning_rate=learning_rate,
update_momentum=update_momentum,
update=nesterov_momentum,
train_split=TrainSplit(eval_size=train_valid_split),
batch_iterator_train=BatchIterator(batch_size=batch_size),
# batch_iterator_train=FlipBatchIterator(batch_size=batch_size),
regression=True,
#.........这里部分代码省略.........