Example #1
0
 def test_subsample_indexes_notsame(self):
     np.random.seed(1234567890)
     indexes = boot.subsample_indexes(np.arange(0,50), 1000, -1)
     # Test to make sure that subsamples are not all the same.
     # In theory, this test could fail even with correct code, but in
     # practice the probability is too low to care, and the test is useful.
     np.testing.assert_(not np.all(indexes[0]==indexes[1:]))
Example #2
0
 def test_subsample_indexes_notsame(self):
     np.random.seed(1234567890)
     indexes = boot.subsample_indexes(np.arange(0, 50), 1000, -1)
     # Test to make sure that subsamples are not all the same.
     # In theory, this test could fail even with correct code, but in
     # practice the probability is too low to care, and the test is useful.
     np.testing.assert_(not np.all(indexes[0] == indexes[1:]))
Example #3
0
 def test_subsample_indexes(self):
     indexes = boot.subsample_indexes(self.data, 1000, 0.5)
     # Each sample when sorted must contain len(self.data)/2 unique numbers (eg, be entirely unique)
     for x in indexes:
         np.testing.assert_(len(np.unique(x)) == len(self.data)/2)
Example #4
0
 def test_subsample_indexes(self):
     indexes = boot.subsample_indexes(self.data, 1000, 0.5)
     # Each sample when sorted must contain len(self.data)/2 unique numbers (eg, be entirely unique)
     for x in indexes:
         np.testing.assert_(len(np.unique(x)) == len(self.data) / 2)