本文整理汇总了Python中nolearn.lasagne.NeuralNet.batch_iterator_train方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNet.batch_iterator_train方法的具体用法?Python NeuralNet.batch_iterator_train怎么用?Python NeuralNet.batch_iterator_train使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nolearn.lasagne.NeuralNet
的用法示例。
在下文中一共展示了NeuralNet.batch_iterator_train方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SimpleBatchIterator
# 需要导入模块: from nolearn.lasagne import NeuralNet [as 别名]
# 或者: from nolearn.lasagne.NeuralNet import batch_iterator_train [as 别名]
input_shape=(None, 1, PIXELS, PIXELS),
conv1_num_filters=32, conv1_filter_size=(3, 3), pool1_ds=(2, 2),
conv2_num_filters=64, conv2_filter_size=(2, 2), pool2_ds=(2, 2),
hidden4_num_units=500,
output_num_units=2, output_nonlinearity=nonlinearities.softmax,
update_learning_rate=0.01,
update_momentum=0.9,
regression=False,
max_epochs=1000,
verbose=1,
)
class SimpleBatchIterator(BatchIterator):
def transform(self, Xb, yb):
Xb, yb = super(SimpleBatchIterator, self).transform(Xb, yb)
# The 'incomming' and outcomming shape is (batchsize, 1, 28, 28)
return Xb[:,:,::-1,:], yb #<--- Here we do the flipping
net1.batch_iterator_train = SimpleBatchIterator(batch_size=128)
net1.fit(X, y)