comparison doc/v2_planning/datalearn.txt @ 1365:049b99f4b323

reply to OD
author Razvan Pascanu <r.pascanu@gmail.com>
date Fri, 12 Nov 2010 11:49:00 -0500
parents 01157763c2d7
children f945ed016c68
comparison
equal deleted inserted replaced
1364:01157763c2d7 1365:049b99f4b323
225 theano.function([index], graph(my_dataset)[index].variable) 225 theano.function([index], graph(my_dataset)[index].variable)
226 while with (1) the same function is compiled implicitly with: 226 while with (1) the same function is compiled implicitly with:
227 for sample in graph(my_dataset): 227 for sample in graph(my_dataset):
228 ... 228 ...
229 229
230 RP answers: right. I was actually constructing this stupid example in my mind when
231 you would do like :
232 i1 = f1(data)
233 i2 = f2(i1)
234 i3 = f3(i2)
235 ...
236 iN = fN(iN-1)
237 and then you would say .. wait I want to do this on new_data as well. Oh no, I
238 have to copy the entire block or whatever. That is so annoying. But actually you
239 could just write:
240
241 def my_f(data):
242 i1 = f1(data)
243 ...
244 return iN
245
246 and then just use that function which is what you pointed out. I agree I'm
247 not sure anymore on the point that I was trying to make. Is like if you are
248 a lazy programmer, and you write everything without functions, you can
249 argue that you like more (2) because you only pass the dataset at the end
250 and not at the beginning. But if (1) would have the replace function this
251 argument will fail. Though this only stands if you like don't want to make
252 a function out of your pipeline that takes the dataset as input, which now
253 that I think about it is pretty stupid not to do. Sorry for that.
254
255
230 - in approach (1) the initial dataset object (the one that loads the data) 256 - in approach (1) the initial dataset object (the one that loads the data)
231 decides if you will use shared variables and indices to deal with the 257 decides if you will use shared variables and indices to deal with the
232 dataset or if you will use ``theano.tensor.matrix`` and not the user( at 258 dataset or if you will use ``theano.tensor.matrix`` and not the user( at
233 least not without hacking the code). Of course whoever writes that class 259 least not without hacking the code). Of course whoever writes that class
234 can add a flag to it to switch between behaviours that make sense. 260 can add a flag to it to switch between behaviours that make sense.