kwikteam / klustakwik2

Fast software for high-dimensional cluster analysis using the masked EM algorithm for Gaussians mixtures
BSD 3-Clause "New" or "Revised" License
27 stars 13 forks source link

Random test error on test_partitioning #48

Closed nippoo closed 9 years ago

nippoo commented 9 years ago

This only happens some of the time.

======================================================================
ERROR: klustakwik2.tests.test_partitioning.test_partitioning
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/miniconda/envs/testenv/lib/python3.3/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/travis/build/kwikteam/klustakwik2/klustakwik2/tests/test_partitioning.py", line 12, in test_partitioning
    data = generate_multimask_test_data(10, 10, 5)
  File "/home/travis/build/kwikteam/klustakwik2/klustakwik2/tests/test_mask_starts.py", line 43, in generate_multimask_test_data
    fet, fmask, unmasked, offsets).to_sparse_data()
  File "/home/travis/build/kwikteam/klustakwik2/klustakwik2/data.py", line 69, in to_sparse_data
    float_num_unmasked = compute_float_num_unmasked(self)
  File "/home/travis/build/kwikteam/klustakwik2/klustakwik2/precomputations.py", line 56, in compute_float_num_unmasked
    return add.reduceat(data.masks, data.offsets[:-1])
IndexError: index 19 out-of-bounds in add.reduceat [0, 19)
thesamovar commented 9 years ago

Oh I never encountered that. Looks like a genuine bug.

nippoo commented 9 years ago

I've only got it once (out of about 20 test runs)

nippoo commented 9 years ago

OK, running it a few thousand times shows it happens about 2.5% of the time (always index n out-of-bounds in add.reduceat [0, n])

thesamovar commented 9 years ago

This should be fixed now: @nippoo can you verify? (It works on mine.)