Mercurial > pylearn
comparison test_dataset.py @ 249:e93e511deb9a
merged
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Tue, 03 Jun 2008 13:18:33 -0400 |
parents | 0fb75fdd727d |
children | 474be3d12c23 |
comparison
equal
deleted
inserted
replaced
248:82ba488b2c24 | 249:e93e511deb9a |
---|---|
498 import time | 498 import time |
499 a2 = numpy.random.rand(100000,400) | 499 a2 = numpy.random.rand(100000,400) |
500 ds = ArrayDataSet(a2,{'all':slice(0,a2.shape[1],1)}) | 500 ds = ArrayDataSet(a2,{'all':slice(0,a2.shape[1],1)}) |
501 mat = numpy.random.rand(400,100) | 501 mat = numpy.random.rand(400,100) |
502 @print_timing | 502 @print_timing |
503 def f_array1(a): | 503 def f_array_full(a): |
504 a+1 | 504 a+1 |
505 @print_timing | 505 @print_timing |
506 def f_array2(a): | 506 def f_array_index(a): |
507 for id in range(a.shape[0]): | 507 for id in range(a.shape[0]): |
508 # pass | 508 # pass |
509 a[id]+1 | 509 a[id]+1 |
510 # a[id]*mat | 510 # a[id]*mat |
511 @print_timing | 511 @print_timing |
512 def f_ds(ds): | 512 def f_array_iter(a): |
513 for r in a: | |
514 # pass | |
515 r+1 | |
516 # r*mat | |
517 @print_timing | |
518 def f_ds_index(ds): | |
519 for id in range(len(ds)): | |
520 # pass | |
521 ds[id][0]+1 | |
522 # ds[id][0]*mat | |
523 @print_timing | |
524 def f_ds_iter(ds): | |
513 for ex in ds: | 525 for ex in ds: |
514 # pass | 526 # pass |
515 ex[0]+1 | 527 ex[0]+1 |
516 # a[id]*mat | 528 # a[0]*mat |
517 @print_timing | 529 @print_timing |
518 def f_ds_mb1(ds,mb_size): | 530 def f_ds_mb1(ds,mb_size): |
519 for exs in ds.minibatches(minibatch_size = mb_size): | 531 for exs in ds.minibatches(minibatch_size = mb_size): |
520 for ex in exs: | 532 for ex in exs: |
521 # pass | 533 # pass |
522 ex[0]+1 | 534 ex[0]+1 |
523 # ex[id]*mat | 535 # ex[0]*mat |
524 @print_timing | 536 @print_timing |
525 def f_ds_mb2(ds,mb_size): | 537 def f_ds_mb2(ds,mb_size): |
526 for exs in ds.minibatches(minibatch_size = mb_size): | 538 for exs in ds.minibatches(minibatch_size = mb_size): |
527 # pass | 539 # pass |
528 exs[0]+1 | 540 exs[0]+1 |
529 # ex[id]*mat | 541 # ex[0]*mat |
530 | 542 |
531 f_array1(a2) | 543 f_array_full(a2) |
532 f_array2(a2) | 544 f_array_index(a2) |
533 | 545 f_array_iter(a2) |
534 f_ds(ds) | 546 |
547 f_ds_index(ds) | |
548 f_ds_iter(ds) | |
535 | 549 |
536 f_ds_mb1(ds,10) | 550 f_ds_mb1(ds,10) |
537 f_ds_mb1(ds,100) | 551 f_ds_mb1(ds,100) |
538 f_ds_mb1(ds,1000) | 552 f_ds_mb1(ds,1000) |
539 f_ds_mb1(ds,10000) | 553 f_ds_mb1(ds,10000) |