ag-csw / LDStreamHMMLearn

1 stars 0 forks source link

Unit Test for MMFamily1 and statconc #11

Closed alexlafleur closed 7 years ago

alexlafleur commented 7 years ago

write unit test with statconc set to 1/64 and assume that the maximum value within the first row is very close to 1 (with at most different of 1e-4)

alexlafleur commented 7 years ago

Difference of 1e-4 might be too small. I regularly get AssertionErrors.

sample: [[ 1.02485350e-01 4.03782062e-04 8.97110868e-01 3.55844156e-50] [ -1.76093460e-02 3.79908231e-01 -8.18703646e-01 4.56404760e-01] [ 3.22423004e-01 1.19796764e-01 -7.90185983e-01 3.47966215e-01] [ 1.42794346e-01 1.97003065e-01 -5.43389703e-01 2.03592292e-01]]

maximum value: 0.897110867732 difference from 1: 0.102889132268

Failure Traceback (most recent call last): File "/home/alexandra/GIT/LDStreamHMMLearn/ldshmm/test/test_MMFamily1.py", line 72, in test_sample_basis_fixed_statconc assert(abs(max_first_row-1) <= 1e-4) AssertionError

greenTara commented 7 years ago

Let's make this test more statistical. Rather then requiring every individual sample from the distribution to satisfy a condition, there will be less failures if we find a statistic that expresses this structure. Options:

  1. the median value of the difference (absolute value)
  2. the mean of the log of the difference

Let's calculate these two value for a number of samples of size, say, 64 and see how stable it is.