msmbuilder / msmbuilder-legacy

Legacy release of MSMBuilder
http://msmbuilder.org
GNU General Public License v2.0
25 stars 28 forks source link

[WIP] Dense rev #407

Closed kyleabeauchamp closed 10 years ago

kyleabeauchamp commented 10 years ago

In the process of debugging this, I saw one strange stochastic test failure of ACF and an eigenvector comparison. Not sure if it was real, hard to reproduce...

kyleabeauchamp commented 10 years ago

I am puzzled by the failures in msm_acf, as they follow this path:

class test_msm_acf():
[...]
acf_msm = msm_analysis.msm_acf(self.T, observable_by_state, self.times)
[...]
    eigenvalues, eigenvectors = get_eigenvectors(tprob, num_modes + 1)
    num_modes = len(eigenvalues) - 1

    populations = eigenvectors[:, 0]
    D = np.diag(populations ** -1.)

    # discard the stationary eigenmode
    eigenvalues = np.real(eigenvalues[1:])
    eigenvectors = np.real(eigenvectors[:, 1:])
    right_eigenvectors = D.dot(eigenvectors)

    eigenvector_normalizer = np.diag(right_eigenvectors.T.dot(eigenvectors))
    eigenvectors /= eigenvector_normalizer

    S = eigenvectors.T.dot(observable)  # Project observable onto left eigenvectors

    acf = np.array([(eigenvalues ** t).dot(S**2) for t in timepoints])

    acf /= (eigenvalues ** 0.).dot(S**2)  # Divide by the ACF at time zero.

So as far as I can tell, the reversible_eigenvectors branch shouldn't even be running in that calculation, right?

kyleabeauchamp commented 10 years ago

OK I think I can reproduce the test failure on the master branch. Seems to be a stochastic failure:

kyleb@kb-intel:~/src/msmbuilder$ git status;nosetests tests/test_msm_analysis.py
# On branch master
nothing to commit (working directory clean)
..
----------------------------------------------------------------------
Ran 2 tests in 0.059s

OK
kyleb@kb-intel:~/src/msmbuilder$ git status;nosetests tests/test_msm_analysis.py
# On branch master
nothing to commit (working directory clean)
..
----------------------------------------------------------------------
Ran 2 tests in 0.064s

OK
kyleb@kb-intel:~/src/msmbuilder$ git status;nosetests tests/test_msm_analysis.py
# On branch master
nothing to commit (working directory clean)
..
----------------------------------------------------------------------
Ran 2 tests in 0.061s

OK
kyleb@kb-intel:~/src/msmbuilder$ git status;nosetests tests/test_msm_analysis.py
# On branch master
nothing to commit (working directory clean)
.F
======================================================================
FAIL: test_msm_analysis.test_msm_acf.test_2
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kyleb/opt/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/kyleb/src/msmbuilder/tests/test_msm_analysis.py", line 40, in test_2
    self.compare_observable_to_statsmodels(observable_by_state)
  File "/home/kyleb/src/msmbuilder/tests/test_msm_analysis.py", line 31, in compare_observable_to_statsmodels
    np.testing.assert_((acf_msm <= max_acf + self.epsilon).all())
  File "/home/kyleb/opt/lib/python2.7/site-packages/numpy/testing/utils.py", line 44, in assert_
    raise AssertionError(msg)
AssertionError

----------------------------------------------------------------------
Ran 2 tests in 0.060s

FAILED (failures=1)