comparison test_dataset.py @ 261:2b91638a11d3

small debugging with dummytests
author Thierry Bertin-Mahieux <bertinmt@iro.umontreal.ca>
date Tue, 03 Jun 2008 16:52:06 -0400
parents 792f81d65f82
children 6e69fb91f3c0
comparison
equal deleted inserted replaced
260:792f81d65f82 261:2b91638a11d3
573 dummytest1_basicstats(ds) 573 dummytest1_basicstats(ds)
574 dummytest2_slicing(ds) 574 dummytest2_slicing(ds)
575 dummytest3_fields_iterator_consistency(ds) 575 dummytest3_fields_iterator_consistency(ds)
576 576
577 577
578 def dummytest1_basicstats(self,ds) : 578 def dummytest1_basicstats(ds) :
579 """print basics stats on a dataset, like length""" 579 """print basics stats on a dataset, like length"""
580 580
581 print 'len(ds) = ',len(ds) 581 print 'len(ds) = ',len(ds)
582 print 'num fields = ', len(ds.fieldNames()) 582 print 'num fields = ', len(ds.fieldNames())
583 print 'types of field: ', 583 print 'types of field: ',
584 for k in ds.fieldNames() : 584 for k in ds.fieldNames() :
585 print type(ds[0](k)[0]), 585 print type(ds[0](k)[0]),
586 print '' 586 print ''
587 587
588 def dummytest2_slicing(self,ds) : 588 def dummytest2_slicing(ds) :
589 """test if slicing works properly""" 589 """test if slicing seems to works properly"""
590 print 'testing slicing...', 590 print 'testing slicing...',
591 sys.stdout.flush() 591 sys.stdout.flush()
592 592
593 middle = len(ds) / 2 593 middle = len(ds) / 2
594 tenpercent = int(len(ds) * .1) 594 tenpercent = int(len(ds) * .1)
611 assert set2[2](k2)[0] == set3[1](k2)[0] 611 assert set2[2](k2)[0] == set3[1](k2)[0]
612 612
613 print 'done' 613 print 'done'
614 614
615 615
616 def dummytest3_fields_iterator_consistency(self,ds) : 616 def dummytest3_fields_iterator_consistency(ds) :
617 """ check if the number of iterator corresponds to the number of fields""" 617 """test if the number of iterator corresponds to the number of fields, also do it for minibatches"""
618 print 'testing fields/iterator consistency...', 618 print 'testing fields/iterator consistency...',
619 sys.stdout.flush() 619 sys.stdout.flush()
620 620
621 # basic test 621 # basic test
622 maxsize = min(len(ds)-1,100) 622 maxsize = min(len(ds)-1,100)