Python utils.shuffler() Examples

The following are 10 code examples of utils.shuffler(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module utils , or try the search function .
Example #1
Source File: test_utils.py    From training_results_v0.5 with Apache License 2.0 5 votes vote down vote up
def test_shuffler(self):
        random.seed(1)
        dataset = (i for i in range(10))
        shuffled = list(utils.shuffler(
            dataset, pool_size=5, refill_threshold=0.8))
        self.assertEqual(len(shuffled), 10)
        self.assertNotEqual(shuffled, list(range(10))) 
Example #2
Source File: test_utils.py    From training_results_v0.5 with Apache License 2.0 5 votes vote down vote up
def test_shuffler(self):
        random.seed(1)
        dataset = (i for i in range(10))
        shuffled = list(utils.shuffler(
            dataset, pool_size=5, refill_threshold=0.8))
        self.assertEqual(len(shuffled), 10)
        self.assertNotEqual(shuffled, list(range(10))) 
Example #3
Source File: test_utils.py    From alphago_demo with Apache License 2.0 5 votes vote down vote up
def test_shuffler(self):
        random.seed(1)
        dataset = (i for i in range(10))
        shuffled = list(utils.shuffler(
            dataset, pool_size=5, refill_threshold=0.8))
        self.assertEqual(len(shuffled), 10)
        self.assertNotEqual(shuffled, list(range(10))) 
Example #4
Source File: load_data_sets.py    From alphago_demo with Apache License 2.0 5 votes vote down vote up
def split_test_training(positions_w_context, est_num_positions):
    print("Estimated number of chunks: %s" % (est_num_positions // CHUNK_SIZE), file=sys.stderr)
    desired_test_size = 10**5
    if est_num_positions < 2 * desired_test_size:
        positions_w_context = list(positions_w_context)
        test_size = len(positions_w_context) // 3
        return positions_w_context[:test_size], [positions_w_context[test_size:]]
    else:
        shuffled_positions = utils.shuffler(positions_w_context)
        test_chunk = utils.take_n(desired_test_size, shuffled_positions)
        training_chunks = utils.iter_chunks(CHUNK_SIZE, shuffled_positions)
        return test_chunk, training_chunks 
Example #5
Source File: utils_test.py    From Gun-Detector with Apache License 2.0 5 votes vote down vote up
def test_shuffler(self):
    random.seed(1)
    dataset = (i for i in range(10))
    shuffled = list(utils.shuffler(
        dataset, pool_size=5, refill_threshold=0.8))
    self.assertEqual(len(shuffled), 10)
    self.assertNotEqual(shuffled, list(range(10))) 
Example #6
Source File: test_utils.py    From AlphaGOZero-python-tensorflow with MIT License 5 votes vote down vote up
def test_shuffler(self):
        random.seed(1)
        dataset = (i for i in range(10))
        shuffled = list(utils.shuffler(
            dataset, pool_size=5, refill_threshold=0.8))
        self.assertEqual(len(shuffled), 10)
        self.assertNotEqual(shuffled, list(range(10))) 
Example #7
Source File: test_utils.py    From AlphaGOZero-python-tensorflow with MIT License 5 votes vote down vote up
def test_shuffler(self):
        random.seed(1)
        dataset = (i for i in range(10))
        shuffled = list(utils.shuffler(
            dataset, pool_size=5, refill_threshold=0.8))
        self.assertEqual(len(shuffled), 10)
        self.assertNotEqual(shuffled, list(range(10))) 
Example #8
Source File: load_data_sets.py    From AlphaGOZero-python-tensorflow with MIT License 5 votes vote down vote up
def split_test_training(positions_w_context, est_num_positions):
    print("Estimated number of chunks: %s" % (est_num_positions // CHUNK_SIZE), file=sys.stderr)
    desired_test_size = 10**5
    if est_num_positions < 2 * desired_test_size:
        positions_w_context = list(positions_w_context)
        test_size = len(positions_w_context) // 3
        return positions_w_context[:test_size], [positions_w_context[test_size:]]
    else:
        shuffled_positions = utils.shuffler(positions_w_context)
        test_chunk = utils.take_n(desired_test_size, shuffled_positions)
        training_chunks = utils.iter_chunks(CHUNK_SIZE, shuffled_positions)
        return test_chunk, training_chunks 
Example #9
Source File: utils_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def test_shuffler(self):
    random.seed(1)
    dataset = (i for i in range(10))
    shuffled = list(utils.shuffler(
        dataset, pool_size=5, refill_threshold=0.8))
    self.assertEqual(len(shuffled), 10)
    self.assertNotEqual(shuffled, list(range(10))) 
Example #10
Source File: utils_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def test_shuffler(self):
    random.seed(1)
    dataset = (i for i in range(10))
    shuffled = list(utils.shuffler(
        dataset, pool_size=5, refill_threshold=0.8))
    self.assertEqual(len(shuffled), 10)
    self.assertNotEqual(shuffled, list(range(10)))