def __call__(self, nn, train_history):
        if self.ls is None:
            self.ls = np.linspace(self.start, self.stop, nn.max_epochs)

        epoch = train_history[-1]['epoch']
        new_value = float32(self.ls[epoch - 1])
        getattr(nn, self.name).set_value(new_value)
Exemplo n.º 2
0
                 pool1_pool_size=(2, 2),
                 dropout1_p=0.1,
                 conv2_num_filters=64,
                 conv2_filter_size=(2, 2),
                 pool2_pool_size=(2, 2),
                 dropout2_p=0.2,
                 conv3_num_filters=128,
                 conv3_filter_size=(2, 2),
                 pool3_pool_size=(2, 2),
                 dropout3_p=0.3,
                 hidden4_num_units=500,
                 dropout4_p=0.5,
                 hidden5_num_units=500,
                 output_num_units=30,
                 output_nonlinearity=None,
                 update_learning_rate=theano.shared(float32(0.03)),
                 update_momentum=theano.shared(float32(0.9)),
                 regression=True,
                 batch_iterator_train=FlipBatchIterator(batch_size=128),
                 on_epoch_finished=[
                     AdjustVariable('update_learning_rate',
                                    start=0.03,
                                    stop=0.0001),
                     AdjustVariable('update_momentum', start=0.9, stop=0.999)
                 ],
                 max_epochs=3000,
                 verbose=1)

X, y = load2d()  # load 2D data
net6.fit(X, y)