Ejemplo n.º 1
0
    def test_bench(self):
        bp = BatchProcessor(
            X_dirpath='../data/train/*',
            y_dirpath='../data/train_cleaned/',
            batchsize=4000000,
            border=2,
            limit=None,
            rnd=rnd)

        start = timer()
        bp.random = False
        bp.slow = True
        for X, y in bp: None
        end = timer()
        print "slow:\t\t %d" % (end - start)

        start = timer()
        bp.random = True
        bp.slow = True
        for X, y in bp: None
        end = timer()
        print "slow rand:\t\t %d" % (end - start)

        start = timer()
        bp.random = False
        bp.slow = False
        for X, y in bp: None
        end = timer()
        print "fast:\t\t %d" % (end - start)

        start = timer()
        bp.random = True
        bp.slow = False
        for X, y in bp: None
        end = timer()
        print "fast rand:\t\t %d" % (end - start)

        start = timer()
        bp.random = True
        bp.random_mode = 'fully'
        bp.slow = False
        for X, y in bp: None
        end = timer()
        print "fully rand:\t\t %d" % (end - start)