In [2]:
# https://gist.github.com/arngarden/6087798
import theano
from pylearn2.models import mlp
from pylearn2.training_algorithms import sgd
from pylearn2.termination_criteria import EpochCounter
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
import numpy as np
from random import randint

In [3]:
class XOR(DenseDesignMatrix):
    def __init__(self):
        self.class_names = ['0', '1']
        X = [[randint(0, 1), randint(0, 1)] for _ in range(1000)]
        y = []
        for a, b in X:
            if a + b == 1:
                y.append([0, 1])
            else:
                y.append([1, 0])
        X = np.array(X)
        y = np.array(y)
        super(XOR, self).__init__(X=X, y=y)

In [4]:
# create XOR dataset
ds = XOR()

In [5]:
print ds.X.shape
print ds.y.shape


(1000, 2)
(1000, 2)

In [6]:
print ds.X[0]
print ds.y[0]


[1 0]
[0 1]

In [5]:
# create hidden layer with 2 nodes, init weights in range -0.1 to 0.1 and add
# a bias with value 1
hidden_layer = mlp.Sigmoid(layer_name='hidden', dim=2, irange=.1, init_bias=1.)

In [6]:
# create Softmax output layer
output_layer = mlp.Softmax(2, 'output', irange=.1)

In [7]:
# create Stochastic Gradient Descent trainer that runs for 400 epochs
trainer = sgd.SGD(learning_rate=.05, batch_size=10, termination_criterion=EpochCounter(400))

In [8]:
layers = [hidden_layer, output_layer]

In [9]:
# create neural net that takes two inputs
ann = mlp.MLP(layers, nvis=2)
trainer.setup(ann, ds)


Parameter and initial learning rate summary:
	hidden_W: 0.05
	hidden_b: 0.05
	softmax_b: 0.05
	softmax_W: 0.05
Compiling sgd_update...
Compiling sgd_update done. Time elapsed: 1.533082 seconds

In [10]:
# train neural net until the termination criterion is true
while True:
    trainer.train(dataset=ds)
    ann.monitor.report_epoch()
    ann.monitor()
    if not trainer.continue_learning(ann):
        break


compiling begin_record_entry...
compiling begin_record_entry done. Time elapsed: 0.013912 seconds
Monitored channels: 
Compiling accum...
Compiling accum done. Time elapsed: 0.000534 seconds
Monitoring step:
	Epochs seen: 1
	Batches seen: 100
	Examples seen: 1000
Monitoring step:
	Epochs seen: 2
	Batches seen: 200
	Examples seen: 2000
Monitoring step:
	Epochs seen: 3
	Batches seen: 300
	Examples seen: 3000
Monitoring step:
	Epochs seen: 4
	Batches seen: 400
	Examples seen: 4000
Monitoring step:
	Epochs seen: 5
	Batches seen: 500
	Examples seen: 5000
Monitoring step:
	Epochs seen: 6
	Batches seen: 600
	Examples seen: 6000
Monitoring step:
	Epochs seen: 7
	Batches seen: 700
	Examples seen: 7000
Monitoring step:
	Epochs seen: 8
	Batches seen: 800
	Examples seen: 8000
Monitoring step:
	Epochs seen: 9
	Batches seen: 900
	Examples seen: 9000
Monitoring step:
	Epochs seen: 10
	Batches seen: 1000
	Examples seen: 10000
Monitoring step:
	Epochs seen: 11
	Batches seen: 1100
	Examples seen: 11000
Monitoring step:
	Epochs seen: 12
	Batches seen: 1200
	Examples seen: 12000
Monitoring step:
	Epochs seen: 13
	Batches seen: 1300
	Examples seen: 13000
Monitoring step:
	Epochs seen: 14
	Batches seen: 1400
	Examples seen: 14000
Monitoring step:
	Epochs seen: 15
	Batches seen: 1500
	Examples seen: 15000
Monitoring step:
	Epochs seen: 16
	Batches seen: 1600
	Examples seen: 16000
Monitoring step:
	Epochs seen: 17
	Batches seen: 1700
	Examples seen: 17000
Monitoring step:
	Epochs seen: 18
	Batches seen: 1800
	Examples seen: 18000
Monitoring step:
	Epochs seen: 19
	Batches seen: 1900
	Examples seen: 19000
Monitoring step:
	Epochs seen: 20
	Batches seen: 2000
	Examples seen: 20000
Monitoring step:
	Epochs seen: 21
	Batches seen: 2100
	Examples seen: 21000
Monitoring step:
	Epochs seen: 22
	Batches seen: 2200
	Examples seen: 22000
Monitoring step:
	Epochs seen: 23
	Batches seen: 2300
	Examples seen: 23000
Monitoring step:
	Epochs seen: 24
	Batches seen: 2400
	Examples seen: 24000
Monitoring step:
	Epochs seen: 25
	Batches seen: 2500
	Examples seen: 25000
Monitoring step:
	Epochs seen: 26
	Batches seen: 2600
	Examples seen: 26000
Monitoring step:
	Epochs seen: 27
	Batches seen: 2700
	Examples seen: 27000
Monitoring step:
	Epochs seen: 28
	Batches seen: 2800
	Examples seen: 28000
Monitoring step:
	Epochs seen: 29
	Batches seen: 2900
	Examples seen: 29000
Monitoring step:
	Epochs seen: 30
	Batches seen: 3000
	Examples seen: 30000
Monitoring step:
	Epochs seen: 31
	Batches seen: 3100
	Examples seen: 31000
Monitoring step:
	Epochs seen: 32
	Batches seen: 3200
	Examples seen: 32000
Monitoring step:
	Epochs seen: 33
	Batches seen: 3300
	Examples seen: 33000
Monitoring step:
	Epochs seen: 34
	Batches seen: 3400
	Examples seen: 34000
Monitoring step:
	Epochs seen: 35
	Batches seen: 3500
	Examples seen: 35000
Monitoring step:
	Epochs seen: 36
	Batches seen: 3600
	Examples seen: 36000
Monitoring step:
	Epochs seen: 37
	Batches seen: 3700
	Examples seen: 37000
Monitoring step:
	Epochs seen: 38
	Batches seen: 3800
	Examples seen: 38000
Monitoring step:
	Epochs seen: 39
	Batches seen: 3900
	Examples seen: 39000
Monitoring step:
	Epochs seen: 40
	Batches seen: 4000
	Examples seen: 40000
Monitoring step:
	Epochs seen: 41
	Batches seen: 4100
	Examples seen: 41000
Monitoring step:
	Epochs seen: 42
	Batches seen: 4200
	Examples seen: 42000
Monitoring step:
	Epochs seen: 43
	Batches seen: 4300
	Examples seen: 43000
Monitoring step:
	Epochs seen: 44
	Batches seen: 4400
	Examples seen: 44000
Monitoring step:
	Epochs seen: 45
	Batches seen: 4500
	Examples seen: 45000
Monitoring step:
	Epochs seen: 46
	Batches seen: 4600
	Examples seen: 46000
Monitoring step:
	Epochs seen: 47
	Batches seen: 4700
	Examples seen: 47000
Monitoring step:
	Epochs seen: 48
	Batches seen: 4800
	Examples seen: 48000
Monitoring step:
	Epochs seen: 49
	Batches seen: 4900
	Examples seen: 49000
Monitoring step:
	Epochs seen: 50
	Batches seen: 5000
	Examples seen: 50000
Monitoring step:
	Epochs seen: 51
	Batches seen: 5100
	Examples seen: 51000
Monitoring step:
	Epochs seen: 52
	Batches seen: 5200
	Examples seen: 52000
Monitoring step:
	Epochs seen: 53
	Batches seen: 5300
	Examples seen: 53000
Monitoring step:
	Epochs seen: 54
	Batches seen: 5400
	Examples seen: 54000
Monitoring step:
	Epochs seen: 55
	Batches seen: 5500
	Examples seen: 55000
Monitoring step:
	Epochs seen: 56
	Batches seen: 5600
	Examples seen: 56000
Monitoring step:
	Epochs seen: 57
	Batches seen: 5700
	Examples seen: 57000
Monitoring step:
	Epochs seen: 58
	Batches seen: 5800
	Examples seen: 58000
Monitoring step:
	Epochs seen: 59
	Batches seen: 5900
	Examples seen: 59000
Monitoring step:
	Epochs seen: 60
	Batches seen: 6000
	Examples seen: 60000
Monitoring step:
	Epochs seen: 61
	Batches seen: 6100
	Examples seen: 61000
Monitoring step:
	Epochs seen: 62
	Batches seen: 6200
	Examples seen: 62000
Monitoring step:
	Epochs seen: 63
	Batches seen: 6300
	Examples seen: 63000
Monitoring step:
	Epochs seen: 64
	Batches seen: 6400
	Examples seen: 64000
Monitoring step:
	Epochs seen: 65
	Batches seen: 6500
	Examples seen: 65000
Monitoring step:
	Epochs seen: 66
	Batches seen: 6600
	Examples seen: 66000
Monitoring step:
	Epochs seen: 67
	Batches seen: 6700
	Examples seen: 67000
Monitoring step:
	Epochs seen: 68
	Batches seen: 6800
	Examples seen: 68000
Monitoring step:
	Epochs seen: 69
	Batches seen: 6900
	Examples seen: 69000
Monitoring step:
	Epochs seen: 70
	Batches seen: 7000
	Examples seen: 70000
Monitoring step:
	Epochs seen: 71
	Batches seen: 7100
	Examples seen: 71000
Monitoring step:
	Epochs seen: 72
	Batches seen: 7200
	Examples seen: 72000
Monitoring step:
	Epochs seen: 73
	Batches seen: 7300
	Examples seen: 73000
Monitoring step:
	Epochs seen: 74
	Batches seen: 7400
	Examples seen: 74000
Monitoring step:
	Epochs seen: 75
	Batches seen: 7500
	Examples seen: 75000
Monitoring step:
	Epochs seen: 76
	Batches seen: 7600
	Examples seen: 76000
Monitoring step:
	Epochs seen: 77
	Batches seen: 7700
	Examples seen: 77000
Monitoring step:
	Epochs seen: 78
	Batches seen: 7800
	Examples seen: 78000
Monitoring step:
	Epochs seen: 79
	Batches seen: 7900
	Examples seen: 79000
Monitoring step:
	Epochs seen: 80
	Batches seen: 8000
	Examples seen: 80000
Monitoring step:
	Epochs seen: 81
	Batches seen: 8100
	Examples seen: 81000
Monitoring step:
	Epochs seen: 82
	Batches seen: 8200
	Examples seen: 82000
Monitoring step:
	Epochs seen: 83
	Batches seen: 8300
	Examples seen: 83000
Monitoring step:
	Epochs seen: 84
	Batches seen: 8400
	Examples seen: 84000
Monitoring step:
	Epochs seen: 85
	Batches seen: 8500
	Examples seen: 85000
Monitoring step:
	Epochs seen: 86
	Batches seen: 8600
	Examples seen: 86000
Monitoring step:
	Epochs seen: 87
	Batches seen: 8700
	Examples seen: 87000
Monitoring step:
	Epochs seen: 88
	Batches seen: 8800
	Examples seen: 88000
Monitoring step:
	Epochs seen: 89
	Batches seen: 8900
	Examples seen: 89000
Monitoring step:
	Epochs seen: 90
	Batches seen: 9000
	Examples seen: 90000
Monitoring step:
	Epochs seen: 91
	Batches seen: 9100
	Examples seen: 91000
Monitoring step:
	Epochs seen: 92
	Batches seen: 9200
	Examples seen: 92000
Monitoring step:
	Epochs seen: 93
	Batches seen: 9300
	Examples seen: 93000
Monitoring step:
	Epochs seen: 94
	Batches seen: 9400
	Examples seen: 94000
Monitoring step:
	Epochs seen: 95
	Batches seen: 9500
	Examples seen: 95000
Monitoring step:
	Epochs seen: 96
	Batches seen: 9600
	Examples seen: 96000
Monitoring step:
	Epochs seen: 97
	Batches seen: 9700
	Examples seen: 97000
Monitoring step:
	Epochs seen: 98
	Batches seen: 9800
	Examples seen: 98000
Monitoring step:
	Epochs seen: 99
	Batches seen: 9900
	Examples seen: 99000
Monitoring step:
	Epochs seen: 100
	Batches seen: 10000
	Examples seen: 100000
Monitoring step:
	Epochs seen: 101
	Batches seen: 10100
	Examples seen: 101000
Monitoring step:
	Epochs seen: 102
	Batches seen: 10200
	Examples seen: 102000
Monitoring step:
	Epochs seen: 103
	Batches seen: 10300
	Examples seen: 103000
Monitoring step:
	Epochs seen: 104
	Batches seen: 10400
	Examples seen: 104000
Monitoring step:
	Epochs seen: 105
	Batches seen: 10500
	Examples seen: 105000
Monitoring step:
	Epochs seen: 106
	Batches seen: 10600
	Examples seen: 106000
Monitoring step:
	Epochs seen: 107
	Batches seen: 10700
	Examples seen: 107000
Monitoring step:
	Epochs seen: 108
	Batches seen: 10800
	Examples seen: 108000
Monitoring step:
	Epochs seen: 109
	Batches seen: 10900
	Examples seen: 109000
Monitoring step:
	Epochs seen: 110
	Batches seen: 11000
	Examples seen: 110000
Monitoring step:
	Epochs seen: 111
	Batches seen: 11100
	Examples seen: 111000
Monitoring step:
	Epochs seen: 112
	Batches seen: 11200
	Examples seen: 112000
Monitoring step:
	Epochs seen: 113
	Batches seen: 11300
	Examples seen: 113000
Monitoring step:
	Epochs seen: 114
	Batches seen: 11400
	Examples seen: 114000
Monitoring step:
	Epochs seen: 115
	Batches seen: 11500
	Examples seen: 115000
Monitoring step:
	Epochs seen: 116
	Batches seen: 11600
	Examples seen: 116000
Monitoring step:
	Epochs seen: 117
	Batches seen: 11700
	Examples seen: 117000
Monitoring step:
	Epochs seen: 118
	Batches seen: 11800
	Examples seen: 118000
Monitoring step:
	Epochs seen: 119
	Batches seen: 11900
	Examples seen: 119000
Monitoring step:
	Epochs seen: 120
	Batches seen: 12000
	Examples seen: 120000
Monitoring step:
	Epochs seen: 121
	Batches seen: 12100
	Examples seen: 121000
Monitoring step:
	Epochs seen: 122
	Batches seen: 12200
	Examples seen: 122000
Monitoring step:
	Epochs seen: 123
	Batches seen: 12300
	Examples seen: 123000
Monitoring step:
	Epochs seen: 124
	Batches seen: 12400
	Examples seen: 124000
Monitoring step:
	Epochs seen: 125
	Batches seen: 12500
	Examples seen: 125000
Monitoring step:
	Epochs seen: 126
	Batches seen: 12600
	Examples seen: 126000
Monitoring step:
	Epochs seen: 127
	Batches seen: 12700
	Examples seen: 127000
Monitoring step:
	Epochs seen: 128
	Batches seen: 12800
	Examples seen: 128000
Monitoring step:
	Epochs seen: 129
	Batches seen: 12900
	Examples seen: 129000
Monitoring step:
	Epochs seen: 130
	Batches seen: 13000
	Examples seen: 130000
Monitoring step:
	Epochs seen: 131
	Batches seen: 13100
	Examples seen: 131000
Monitoring step:
	Epochs seen: 132
	Batches seen: 13200
	Examples seen: 132000
Monitoring step:
	Epochs seen: 133
	Batches seen: 13300
	Examples seen: 133000
Monitoring step:
	Epochs seen: 134
	Batches seen: 13400
	Examples seen: 134000
Monitoring step:
	Epochs seen: 135
	Batches seen: 13500
	Examples seen: 135000
Monitoring step:
	Epochs seen: 136
	Batches seen: 13600
	Examples seen: 136000
Monitoring step:
	Epochs seen: 137
	Batches seen: 13700
	Examples seen: 137000
Monitoring step:
	Epochs seen: 138
	Batches seen: 13800
	Examples seen: 138000
Monitoring step:
	Epochs seen: 139
	Batches seen: 13900
	Examples seen: 139000
Monitoring step:
	Epochs seen: 140
	Batches seen: 14000
	Examples seen: 140000
Monitoring step:
	Epochs seen: 141
	Batches seen: 14100
	Examples seen: 141000
Monitoring step:
	Epochs seen: 142
	Batches seen: 14200
	Examples seen: 142000
Monitoring step:
	Epochs seen: 143
	Batches seen: 14300
	Examples seen: 143000
Monitoring step:
	Epochs seen: 144
	Batches seen: 14400
	Examples seen: 144000
Monitoring step:
	Epochs seen: 145
	Batches seen: 14500
	Examples seen: 145000
Monitoring step:
	Epochs seen: 146
	Batches seen: 14600
	Examples seen: 146000
Monitoring step:
	Epochs seen: 147
	Batches seen: 14700
	Examples seen: 147000
Monitoring step:
	Epochs seen: 148
	Batches seen: 14800
	Examples seen: 148000
Monitoring step:
	Epochs seen: 149
	Batches seen: 14900
	Examples seen: 149000
Monitoring step:
	Epochs seen: 150
	Batches seen: 15000
	Examples seen: 150000
Monitoring step:
	Epochs seen: 151
	Batches seen: 15100
	Examples seen: 151000
Monitoring step:
	Epochs seen: 152
	Batches seen: 15200
	Examples seen: 152000
Monitoring step:
	Epochs seen: 153
	Batches seen: 15300
	Examples seen: 153000
Monitoring step:
	Epochs seen: 154
	Batches seen: 15400
	Examples seen: 154000
Monitoring step:
	Epochs seen: 155
	Batches seen: 15500
	Examples seen: 155000
Monitoring step:
	Epochs seen: 156
	Batches seen: 15600
	Examples seen: 156000
Monitoring step:
	Epochs seen: 157
	Batches seen: 15700
	Examples seen: 157000
Monitoring step:
	Epochs seen: 158
	Batches seen: 15800
	Examples seen: 158000
Monitoring step:
	Epochs seen: 159
	Batches seen: 15900
	Examples seen: 159000
Monitoring step:
	Epochs seen: 160
	Batches seen: 16000
	Examples seen: 160000
Monitoring step:
	Epochs seen: 161
	Batches seen: 16100
	Examples seen: 161000
Monitoring step:
	Epochs seen: 162
	Batches seen: 16200
	Examples seen: 162000
Monitoring step:
	Epochs seen: 163
	Batches seen: 16300
	Examples seen: 163000
Monitoring step:
	Epochs seen: 164
	Batches seen: 16400
	Examples seen: 164000
Monitoring step:
	Epochs seen: 165
	Batches seen: 16500
	Examples seen: 165000
Monitoring step:
	Epochs seen: 166
	Batches seen: 16600
	Examples seen: 166000
Monitoring step:
	Epochs seen: 167
	Batches seen: 16700
	Examples seen: 167000
Monitoring step:
	Epochs seen: 168
	Batches seen: 16800
	Examples seen: 168000
Monitoring step:
	Epochs seen: 169
	Batches seen: 16900
	Examples seen: 169000
Monitoring step:
	Epochs seen: 170
	Batches seen: 17000
	Examples seen: 170000
Monitoring step:
	Epochs seen: 171
	Batches seen: 17100
	Examples seen: 171000
Monitoring step:
	Epochs seen: 172
	Batches seen: 17200
	Examples seen: 172000
Monitoring step:
	Epochs seen: 173
	Batches seen: 17300
	Examples seen: 173000
Monitoring step:
	Epochs seen: 174
	Batches seen: 17400
	Examples seen: 174000
Monitoring step:
	Epochs seen: 175
	Batches seen: 17500
	Examples seen: 175000
Monitoring step:
	Epochs seen: 176
	Batches seen: 17600
	Examples seen: 176000
Monitoring step:
	Epochs seen: 177
	Batches seen: 17700
	Examples seen: 177000
Monitoring step:
	Epochs seen: 178
	Batches seen: 17800
	Examples seen: 178000
Monitoring step:
	Epochs seen: 179
	Batches seen: 17900
	Examples seen: 179000
Monitoring step:
	Epochs seen: 180
	Batches seen: 18000
	Examples seen: 180000
Monitoring step:
	Epochs seen: 181
	Batches seen: 18100
	Examples seen: 181000
Monitoring step:
	Epochs seen: 182
	Batches seen: 18200
	Examples seen: 182000
Monitoring step:
	Epochs seen: 183
	Batches seen: 18300
	Examples seen: 183000
Monitoring step:
	Epochs seen: 184
	Batches seen: 18400
	Examples seen: 184000
Monitoring step:
	Epochs seen: 185
	Batches seen: 18500
	Examples seen: 185000
Monitoring step:
	Epochs seen: 186
	Batches seen: 18600
	Examples seen: 186000
Monitoring step:
	Epochs seen: 187
	Batches seen: 18700
	Examples seen: 187000
Monitoring step:
	Epochs seen: 188
	Batches seen: 18800
	Examples seen: 188000
Monitoring step:
	Epochs seen: 189
	Batches seen: 18900
	Examples seen: 189000
Monitoring step:
	Epochs seen: 190
	Batches seen: 19000
	Examples seen: 190000
Monitoring step:
	Epochs seen: 191
	Batches seen: 19100
	Examples seen: 191000
Monitoring step:
	Epochs seen: 192
	Batches seen: 19200
	Examples seen: 192000
Monitoring step:
	Epochs seen: 193
	Batches seen: 19300
	Examples seen: 193000
Monitoring step:
	Epochs seen: 194
	Batches seen: 19400
	Examples seen: 194000
Monitoring step:
	Epochs seen: 195
	Batches seen: 19500
	Examples seen: 195000
Monitoring step:
	Epochs seen: 196
	Batches seen: 19600
	Examples seen: 196000
Monitoring step:
	Epochs seen: 197
	Batches seen: 19700
	Examples seen: 197000
Monitoring step:
	Epochs seen: 198
	Batches seen: 19800
	Examples seen: 198000
Monitoring step:
	Epochs seen: 199
	Batches seen: 19900
	Examples seen: 199000
Monitoring step:
	Epochs seen: 200
	Batches seen: 20000
	Examples seen: 200000
Monitoring step:
	Epochs seen: 201
	Batches seen: 20100
	Examples seen: 201000
Monitoring step:
	Epochs seen: 202
	Batches seen: 20200
	Examples seen: 202000
Monitoring step:
	Epochs seen: 203
	Batches seen: 20300
	Examples seen: 203000
Monitoring step:
	Epochs seen: 204
	Batches seen: 20400
	Examples seen: 204000
Monitoring step:
	Epochs seen: 205
	Batches seen: 20500
	Examples seen: 205000
Monitoring step:
	Epochs seen: 206
	Batches seen: 20600
	Examples seen: 206000
Monitoring step:
	Epochs seen: 207
	Batches seen: 20700
	Examples seen: 207000
Monitoring step:
	Epochs seen: 208
	Batches seen: 20800
	Examples seen: 208000
Monitoring step:
	Epochs seen: 209
	Batches seen: 20900
	Examples seen: 209000
Monitoring step:
	Epochs seen: 210
	Batches seen: 21000
	Examples seen: 210000
Monitoring step:
	Epochs seen: 211
	Batches seen: 21100
	Examples seen: 211000
Monitoring step:
	Epochs seen: 212
	Batches seen: 21200
	Examples seen: 212000
Monitoring step:
	Epochs seen: 213
	Batches seen: 21300
	Examples seen: 213000
Monitoring step:
	Epochs seen: 214
	Batches seen: 21400
	Examples seen: 214000
Monitoring step:
	Epochs seen: 215
	Batches seen: 21500
	Examples seen: 215000
Monitoring step:
	Epochs seen: 216
	Batches seen: 21600
	Examples seen: 216000
Monitoring step:
	Epochs seen: 217
	Batches seen: 21700
	Examples seen: 217000
Monitoring step:
	Epochs seen: 218
	Batches seen: 21800
	Examples seen: 218000
Monitoring step:
	Epochs seen: 219
	Batches seen: 21900
	Examples seen: 219000
Monitoring step:
	Epochs seen: 220
	Batches seen: 22000
	Examples seen: 220000
Monitoring step:
	Epochs seen: 221
	Batches seen: 22100
	Examples seen: 221000
Monitoring step:
	Epochs seen: 222
	Batches seen: 22200
	Examples seen: 222000
Monitoring step:
	Epochs seen: 223
	Batches seen: 22300
	Examples seen: 223000
Monitoring step:
	Epochs seen: 224
	Batches seen: 22400
	Examples seen: 224000
Monitoring step:
	Epochs seen: 225
	Batches seen: 22500
	Examples seen: 225000
Monitoring step:
	Epochs seen: 226
	Batches seen: 22600
	Examples seen: 226000
Monitoring step:
	Epochs seen: 227
	Batches seen: 22700
	Examples seen: 227000
Monitoring step:
	Epochs seen: 228
	Batches seen: 22800
	Examples seen: 228000
Monitoring step:
	Epochs seen: 229
	Batches seen: 22900
	Examples seen: 229000
Monitoring step:
	Epochs seen: 230
	Batches seen: 23000
	Examples seen: 230000
Monitoring step:
	Epochs seen: 231
	Batches seen: 23100
	Examples seen: 231000
Monitoring step:
	Epochs seen: 232
	Batches seen: 23200
	Examples seen: 232000
Monitoring step:
	Epochs seen: 233
	Batches seen: 23300
	Examples seen: 233000
Monitoring step:
	Epochs seen: 234
	Batches seen: 23400
	Examples seen: 234000
Monitoring step:
	Epochs seen: 235
	Batches seen: 23500
	Examples seen: 235000
Monitoring step:
	Epochs seen: 236
	Batches seen: 23600
	Examples seen: 236000
Monitoring step:
	Epochs seen: 237
	Batches seen: 23700
	Examples seen: 237000
Monitoring step:
	Epochs seen: 238
	Batches seen: 23800
	Examples seen: 238000
Monitoring step:
	Epochs seen: 239
	Batches seen: 23900
	Examples seen: 239000
Monitoring step:
	Epochs seen: 240
	Batches seen: 24000
	Examples seen: 240000
Monitoring step:
	Epochs seen: 241
	Batches seen: 24100
	Examples seen: 241000
Monitoring step:
	Epochs seen: 242
	Batches seen: 24200
	Examples seen: 242000
Monitoring step:
	Epochs seen: 243
	Batches seen: 24300
	Examples seen: 243000
Monitoring step:
	Epochs seen: 244
	Batches seen: 24400
	Examples seen: 244000
Monitoring step:
	Epochs seen: 245
	Batches seen: 24500
	Examples seen: 245000
Monitoring step:
	Epochs seen: 246
	Batches seen: 24600
	Examples seen: 246000
Monitoring step:
	Epochs seen: 247
	Batches seen: 24700
	Examples seen: 247000
Monitoring step:
	Epochs seen: 248
	Batches seen: 24800
	Examples seen: 248000
Monitoring step:
	Epochs seen: 249
	Batches seen: 24900
	Examples seen: 249000
Monitoring step:
	Epochs seen: 250
	Batches seen: 25000
	Examples seen: 250000
Monitoring step:
	Epochs seen: 251
	Batches seen: 25100
	Examples seen: 251000
Monitoring step:
	Epochs seen: 252
	Batches seen: 25200
	Examples seen: 252000
Monitoring step:
	Epochs seen: 253
	Batches seen: 25300
	Examples seen: 253000
Monitoring step:
	Epochs seen: 254
	Batches seen: 25400
	Examples seen: 254000
Monitoring step:
	Epochs seen: 255
	Batches seen: 25500
	Examples seen: 255000
Monitoring step:
	Epochs seen: 256
	Batches seen: 25600
	Examples seen: 256000
Monitoring step:
	Epochs seen: 257
	Batches seen: 25700
	Examples seen: 257000
Monitoring step:
	Epochs seen: 258
	Batches seen: 25800
	Examples seen: 258000
Monitoring step:
	Epochs seen: 259
	Batches seen: 25900
	Examples seen: 259000
Monitoring step:
	Epochs seen: 260
	Batches seen: 26000
	Examples seen: 260000
Monitoring step:
	Epochs seen: 261
	Batches seen: 26100
	Examples seen: 261000
Monitoring step:
	Epochs seen: 262
	Batches seen: 26200
	Examples seen: 262000
Monitoring step:
	Epochs seen: 263
	Batches seen: 26300
	Examples seen: 263000
Monitoring step:
	Epochs seen: 264
	Batches seen: 26400
	Examples seen: 264000
Monitoring step:
	Epochs seen: 265
	Batches seen: 26500
	Examples seen: 265000
Monitoring step:
	Epochs seen: 266
	Batches seen: 26600
	Examples seen: 266000
Monitoring step:
	Epochs seen: 267
	Batches seen: 26700
	Examples seen: 267000
Monitoring step:
	Epochs seen: 268
	Batches seen: 26800
	Examples seen: 268000
Monitoring step:
	Epochs seen: 269
	Batches seen: 26900
	Examples seen: 269000
Monitoring step:
	Epochs seen: 270
	Batches seen: 27000
	Examples seen: 270000
Monitoring step:
	Epochs seen: 271
	Batches seen: 27100
	Examples seen: 271000
Monitoring step:
	Epochs seen: 272
	Batches seen: 27200
	Examples seen: 272000
Monitoring step:
	Epochs seen: 273
	Batches seen: 27300
	Examples seen: 273000
Monitoring step:
	Epochs seen: 274
	Batches seen: 27400
	Examples seen: 274000
Monitoring step:
	Epochs seen: 275
	Batches seen: 27500
	Examples seen: 275000
Monitoring step:
	Epochs seen: 276
	Batches seen: 27600
	Examples seen: 276000
Monitoring step:
	Epochs seen: 277
	Batches seen: 27700
	Examples seen: 277000
Monitoring step:
	Epochs seen: 278
	Batches seen: 27800
	Examples seen: 278000
Monitoring step:
	Epochs seen: 279
	Batches seen: 27900
	Examples seen: 279000
Monitoring step:
	Epochs seen: 280
	Batches seen: 28000
	Examples seen: 280000
Monitoring step:
	Epochs seen: 281
	Batches seen: 28100
	Examples seen: 281000
Monitoring step:
	Epochs seen: 282
	Batches seen: 28200
	Examples seen: 282000
Monitoring step:
	Epochs seen: 283
	Batches seen: 28300
	Examples seen: 283000
Monitoring step:
	Epochs seen: 284
	Batches seen: 28400
	Examples seen: 284000
Monitoring step:
	Epochs seen: 285
	Batches seen: 28500
	Examples seen: 285000
Monitoring step:
	Epochs seen: 286
	Batches seen: 28600
	Examples seen: 286000
Monitoring step:
	Epochs seen: 287
	Batches seen: 28700
	Examples seen: 287000
Monitoring step:
	Epochs seen: 288
	Batches seen: 28800
	Examples seen: 288000
Monitoring step:
	Epochs seen: 289
	Batches seen: 28900
	Examples seen: 289000
Monitoring step:
	Epochs seen: 290
	Batches seen: 29000
	Examples seen: 290000
Monitoring step:
	Epochs seen: 291
	Batches seen: 29100
	Examples seen: 291000
Monitoring step:
	Epochs seen: 292
	Batches seen: 29200
	Examples seen: 292000
Monitoring step:
	Epochs seen: 293
	Batches seen: 29300
	Examples seen: 293000
Monitoring step:
	Epochs seen: 294
	Batches seen: 29400
	Examples seen: 294000
Monitoring step:
	Epochs seen: 295
	Batches seen: 29500
	Examples seen: 295000
Monitoring step:
	Epochs seen: 296
	Batches seen: 29600
	Examples seen: 296000
Monitoring step:
	Epochs seen: 297
	Batches seen: 29700
	Examples seen: 297000
Monitoring step:
	Epochs seen: 298
	Batches seen: 29800
	Examples seen: 298000
Monitoring step:
	Epochs seen: 299
	Batches seen: 29900
	Examples seen: 299000
Monitoring step:
	Epochs seen: 300
	Batches seen: 30000
	Examples seen: 300000
Monitoring step:
	Epochs seen: 301
	Batches seen: 30100
	Examples seen: 301000
Monitoring step:
	Epochs seen: 302
	Batches seen: 30200
	Examples seen: 302000
Monitoring step:
	Epochs seen: 303
	Batches seen: 30300
	Examples seen: 303000
Monitoring step:
	Epochs seen: 304
	Batches seen: 30400
	Examples seen: 304000
Monitoring step:
	Epochs seen: 305
	Batches seen: 30500
	Examples seen: 305000
Monitoring step:
	Epochs seen: 306
	Batches seen: 30600
	Examples seen: 306000
Monitoring step:
	Epochs seen: 307
	Batches seen: 30700
	Examples seen: 307000
Monitoring step:
	Epochs seen: 308
	Batches seen: 30800
	Examples seen: 308000
Monitoring step:
	Epochs seen: 309
	Batches seen: 30900
	Examples seen: 309000
Monitoring step:
	Epochs seen: 310
	Batches seen: 31000
	Examples seen: 310000
Monitoring step:
	Epochs seen: 311
	Batches seen: 31100
	Examples seen: 311000
Monitoring step:
	Epochs seen: 312
	Batches seen: 31200
	Examples seen: 312000
Monitoring step:
	Epochs seen: 313
	Batches seen: 31300
	Examples seen: 313000
Monitoring step:
	Epochs seen: 314
	Batches seen: 31400
	Examples seen: 314000
Monitoring step:
	Epochs seen: 315
	Batches seen: 31500
	Examples seen: 315000
Monitoring step:
	Epochs seen: 316
	Batches seen: 31600
	Examples seen: 316000
Monitoring step:
	Epochs seen: 317
	Batches seen: 31700
	Examples seen: 317000
Monitoring step:
	Epochs seen: 318
	Batches seen: 31800
	Examples seen: 318000
Monitoring step:
	Epochs seen: 319
	Batches seen: 31900
	Examples seen: 319000
Monitoring step:
	Epochs seen: 320
	Batches seen: 32000
	Examples seen: 320000
Monitoring step:
	Epochs seen: 321
	Batches seen: 32100
	Examples seen: 321000
Monitoring step:
	Epochs seen: 322
	Batches seen: 32200
	Examples seen: 322000
Monitoring step:
	Epochs seen: 323
	Batches seen: 32300
	Examples seen: 323000
Monitoring step:
	Epochs seen: 324
	Batches seen: 32400
	Examples seen: 324000
Monitoring step:
	Epochs seen: 325
	Batches seen: 32500
	Examples seen: 325000
Monitoring step:
	Epochs seen: 326
	Batches seen: 32600
	Examples seen: 326000
Monitoring step:
	Epochs seen: 327
	Batches seen: 32700
	Examples seen: 327000
Monitoring step:
	Epochs seen: 328
	Batches seen: 32800
	Examples seen: 328000
Monitoring step:
	Epochs seen: 329
	Batches seen: 32900
	Examples seen: 329000
Monitoring step:
	Epochs seen: 330
	Batches seen: 33000
	Examples seen: 330000
Monitoring step:
	Epochs seen: 331
	Batches seen: 33100
	Examples seen: 331000
Monitoring step:
	Epochs seen: 332
	Batches seen: 33200
	Examples seen: 332000
Monitoring step:
	Epochs seen: 333
	Batches seen: 33300
	Examples seen: 333000
Monitoring step:
	Epochs seen: 334
	Batches seen: 33400
	Examples seen: 334000
Monitoring step:
	Epochs seen: 335
	Batches seen: 33500
	Examples seen: 335000
Monitoring step:
	Epochs seen: 336
	Batches seen: 33600
	Examples seen: 336000
Monitoring step:
	Epochs seen: 337
	Batches seen: 33700
	Examples seen: 337000
Monitoring step:
	Epochs seen: 338
	Batches seen: 33800
	Examples seen: 338000
Monitoring step:
	Epochs seen: 339
	Batches seen: 33900
	Examples seen: 339000
Monitoring step:
	Epochs seen: 340
	Batches seen: 34000
	Examples seen: 340000
Monitoring step:
	Epochs seen: 341
	Batches seen: 34100
	Examples seen: 341000
Monitoring step:
	Epochs seen: 342
	Batches seen: 34200
	Examples seen: 342000
Monitoring step:
	Epochs seen: 343
	Batches seen: 34300
	Examples seen: 343000
Monitoring step:
	Epochs seen: 344
	Batches seen: 34400
	Examples seen: 344000
Monitoring step:
	Epochs seen: 345
	Batches seen: 34500
	Examples seen: 345000
Monitoring step:
	Epochs seen: 346
	Batches seen: 34600
	Examples seen: 346000
Monitoring step:
	Epochs seen: 347
	Batches seen: 34700
	Examples seen: 347000
Monitoring step:
	Epochs seen: 348
	Batches seen: 34800
	Examples seen: 348000
Monitoring step:
	Epochs seen: 349
	Batches seen: 34900
	Examples seen: 349000
Monitoring step:
	Epochs seen: 350
	Batches seen: 35000
	Examples seen: 350000
Monitoring step:
	Epochs seen: 351
	Batches seen: 35100
	Examples seen: 351000
Monitoring step:
	Epochs seen: 352
	Batches seen: 35200
	Examples seen: 352000
Monitoring step:
	Epochs seen: 353
	Batches seen: 35300
	Examples seen: 353000
Monitoring step:
	Epochs seen: 354
	Batches seen: 35400
	Examples seen: 354000
Monitoring step:
	Epochs seen: 355
	Batches seen: 35500
	Examples seen: 355000
Monitoring step:
	Epochs seen: 356
	Batches seen: 35600
	Examples seen: 356000
Monitoring step:
	Epochs seen: 357
	Batches seen: 35700
	Examples seen: 357000
Monitoring step:
	Epochs seen: 358
	Batches seen: 35800
	Examples seen: 358000
Monitoring step:
	Epochs seen: 359
	Batches seen: 35900
	Examples seen: 359000
Monitoring step:
	Epochs seen: 360
	Batches seen: 36000
	Examples seen: 360000
Monitoring step:
	Epochs seen: 361
	Batches seen: 36100
	Examples seen: 361000
Monitoring step:
	Epochs seen: 362
	Batches seen: 36200
	Examples seen: 362000
Monitoring step:
	Epochs seen: 363
	Batches seen: 36300
	Examples seen: 363000
Monitoring step:
	Epochs seen: 364
	Batches seen: 36400
	Examples seen: 364000
Monitoring step:
	Epochs seen: 365
	Batches seen: 36500
	Examples seen: 365000
Monitoring step:
	Epochs seen: 366
	Batches seen: 36600
	Examples seen: 366000
Monitoring step:
	Epochs seen: 367
	Batches seen: 36700
	Examples seen: 367000
Monitoring step:
	Epochs seen: 368
	Batches seen: 36800
	Examples seen: 368000
Monitoring step:
	Epochs seen: 369
	Batches seen: 36900
	Examples seen: 369000
Monitoring step:
	Epochs seen: 370
	Batches seen: 37000
	Examples seen: 370000
Monitoring step:
	Epochs seen: 371
	Batches seen: 37100
	Examples seen: 371000
Monitoring step:
	Epochs seen: 372
	Batches seen: 37200
	Examples seen: 372000
Monitoring step:
	Epochs seen: 373
	Batches seen: 37300
	Examples seen: 373000
Monitoring step:
	Epochs seen: 374
	Batches seen: 37400
	Examples seen: 374000
Monitoring step:
	Epochs seen: 375
	Batches seen: 37500
	Examples seen: 375000
Monitoring step:
	Epochs seen: 376
	Batches seen: 37600
	Examples seen: 376000
Monitoring step:
	Epochs seen: 377
	Batches seen: 37700
	Examples seen: 377000
Monitoring step:
	Epochs seen: 378
	Batches seen: 37800
	Examples seen: 378000
Monitoring step:
	Epochs seen: 379
	Batches seen: 37900
	Examples seen: 379000
Monitoring step:
	Epochs seen: 380
	Batches seen: 38000
	Examples seen: 380000
Monitoring step:
	Epochs seen: 381
	Batches seen: 38100
	Examples seen: 381000
Monitoring step:
	Epochs seen: 382
	Batches seen: 38200
	Examples seen: 382000
Monitoring step:
	Epochs seen: 383
	Batches seen: 38300
	Examples seen: 383000
Monitoring step:
	Epochs seen: 384
	Batches seen: 38400
	Examples seen: 384000
Monitoring step:
	Epochs seen: 385
	Batches seen: 38500
	Examples seen: 385000
Monitoring step:
	Epochs seen: 386
	Batches seen: 38600
	Examples seen: 386000
Monitoring step:
	Epochs seen: 387
	Batches seen: 38700
	Examples seen: 387000
Monitoring step:
	Epochs seen: 388
	Batches seen: 38800
	Examples seen: 388000
Monitoring step:
	Epochs seen: 389
	Batches seen: 38900
	Examples seen: 389000
Monitoring step:
	Epochs seen: 390
	Batches seen: 39000
	Examples seen: 390000
Monitoring step:
	Epochs seen: 391
	Batches seen: 39100
	Examples seen: 391000
Monitoring step:
	Epochs seen: 392
	Batches seen: 39200
	Examples seen: 392000
Monitoring step:
	Epochs seen: 393
	Batches seen: 39300
	Examples seen: 393000
Monitoring step:
	Epochs seen: 394
	Batches seen: 39400
	Examples seen: 394000
Monitoring step:
	Epochs seen: 395
	Batches seen: 39500
	Examples seen: 395000
Monitoring step:
	Epochs seen: 396
	Batches seen: 39600
	Examples seen: 396000
Monitoring step:
	Epochs seen: 397
	Batches seen: 39700
	Examples seen: 397000
Monitoring step:
	Epochs seen: 398
	Batches seen: 39800
	Examples seen: 398000
Monitoring step:
	Epochs seen: 399
	Batches seen: 39900
	Examples seen: 399000
Monitoring step:
	Epochs seen: 400
	Batches seen: 40000
	Examples seen: 400000
Monitoring step:
	Epochs seen: 401
	Batches seen: 40100
	Examples seen: 401000

In [11]:
inputs = np.array([[0, 0]])
print ann.fprop(theano.shared(inputs, name='inputs')).eval()
inputs = np.array([[0, 1]])
print ann.fprop(theano.shared(inputs, name='inputs')).eval()
inputs = np.array([[1, 0]])
print ann.fprop(theano.shared(inputs, name='inputs')).eval()
inputs = np.array([[1, 1]])
print ann.fprop(theano.shared(inputs, name='inputs')).eval()


[[ 0.96310425  0.03689575]]
[[ 0.04224482  0.95775518]]
[[ 0.04463144  0.95536856]]
[[ 0.97087054  0.02912946]]

In [12]:
ann.fprop


Out[12]:
<bound method MLP.fprop of <pylearn2.models.mlp.MLP object at 0x1042d3610>>