radical-collaboration / extasy-grlsd

Repository to hold the input data and scripts for the ExTASY gromacs-lsdmap work
1 stars 1 forks source link

koopman error #67

Closed euhruska closed 6 years ago

euhruska commented 6 years ago

koopman error, ('n atoms', 6105) ('n frames total', 400000) ('n trajs', 200) (' input dimension', 64) chignolin

  File "run-tica-msm.py", line 645, in <module>
    Runticamsm().run()
  File "run-tica-msm.py", line 130, in run
    tica_obj = pyemma.coordinates.tica(inp, lag=tica_lag, dim=tica_dim, kinetic_map=True, stride=tica_stride, weights=tica_weights)
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/coordinates/api.py", line 1261, in tica
    res.estimate(data, chunksize=cs)
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/coordinates/transform/tica.py", line 159, in estimate
    return super(TICA, self).estimate(X, **kwargs)
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/coordinates/data/_base/transformer.py", line 216, in estimate
    super(StreamingEstimationTransformer, self).estimate(X, **kwargs)
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/coordinates/data/_base/streaming_estimator.py", line 45, in estimate
    super(StreamingEstimator, self).estimate(X, **kwargs)
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/_base/estimator.py", line 415, in estimate
    self._model = self._estimate(X)
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/coordinates/transform/tica.py", line 210, in _estimate
    self._diagonalize()
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/coordinates/transform/tica.py", line 218, in _diagonalize
    eigenvalues, eigenvectors = eig_corr(self.cov, self.cov_tau, self.epsilon, sign_maxelement=True)
  File "/mnt/b/projects/sciteam/bamm/hruska/vpy2/lib/python2.7/site-packages/pyemma/_ext/variational/solvers/direct.py", line 278, in eig_corr
    l, R_trans = eigh(Ct_trans)
  File "/sw/bw/bwpy/0.3.0/python-single/usr/lib/python2.7/site-packages/scipy/linalg/decomp.py", line 288, in eigh
    a1 = _asarray_validated(a, check_finite=check_finite)
  File "/sw/bw/bwpy/0.3.0/python-single/usr/lib/python2.7/site-packages/scipy/_lib/_util.py", line 228, in _asarray_validated
    a = toarray(a)
  File "/sw/bw/bwpy/0.3.0/python-single/usr/lib/python2.7/site-packages/numpy/lib/function_base.py", line 1033, in asarray_chkfinite
    "array must not contain infs or NaNs")
ValueError: array must not contain infs or NaNs
euhruska commented 6 years ago

@fnueske

euhruska commented 6 years ago

script https://github.com/radical-collaboration/extasy-grlsd/blob/master/helper_scripts/run-tica-msm.py

euhruska commented 6 years ago

/u/sciteam/hruska/scratch/radical.pilot.sandbox/rp.session.leonardo.rice.edu.eh22.017758.0032/pilot.0000/unit.000006 ntl9

fnueske commented 6 years ago

Eugen, can you apply the following code block to the data in question:

koop = _KoopmanEstimator(lag=lag, stride=stride, skip=skip) koop.estimate(data, chunksize=cs) weights = koop.weights

This part computes the Koopman weights. If they contain infs or nans, these will be handed all the way down, until something fails. Parameters need to be the same as in your call to tica().

euhruska commented 6 years ago

Saved weights as .npz file koop_weights.zip <pyemma.coordinates.estimation.koopman._KoopmanWeights object at 0x2aaacc893f90>

euhruska commented 6 years ago

koop.u:

[ -1.44741269  -1.41021442  -1.27524134   6.80435086  -6.35325017
  -0.57527146  11.31252763   4.32273943   1.29092326   2.96443575
   4.65027585   2.9741678    6.25532477  -0.37797697  -6.12253137
   3.64938295  -4.4162159    4.8008984   -1.31151944  -1.48437946
   7.60312911  11.7213386    0.2185055   -1.70546792   0.45421057
  -0.40038417   0.75047135  -6.18444047  -0.0631904    0.06792182
  -0.22481375   0.10486416   0.38483166   0.69899538  -0.55630278
   0.72069352   0.17300695   0.08101199  -0.28783623   0.91205656
   0.42951334   0.46678493  -0.34448013  -0.14536374   0.67195342
  -0.78990925  -1.01149807   1.24252342   0.37738346  -0.19936891
   0.86359818   0.04082861  -0.23270495   0.28802588   0.1044228
  -0.17448741   0.15703285  -0.4583108   -1.1777493    0.48086512
  -1.19407233   0.77045126   1.68329875   0.66453219 -12.50235234]
euhruska commented 6 years ago
('C00', array([[ 0.01338558,  0.00687435,  0.01676794, ...,  0.0021919 ,
         0.01704439,  0.0221973 ],
       [ 0.00687435,  0.00737539,  0.00982822, ..., -0.00094557,
        -0.00635372, -0.00672989],
       [ 0.01676794,  0.00982822,  0.02592116, ...,  0.00186075,
         0.0051857 ,  0.0110813 ],
       ...,
       [ 0.0021919 , -0.00094557,  0.00186075, ...,  0.01462137,
        -0.04286392, -0.03869312],
       [ 0.01704439, -0.00635372,  0.0051857 , ..., -0.04286392,
        -0.05754377, -0.20701788],
       [ 0.0221973 , -0.00672989,  0.0110813 , ..., -0.03869312,
        -0.20701788, -0.27758687]]))
('C0t', array([[  9.79153985e-03,   4.86193957e-03,   1.33699098e-02, ...,
          2.62236616e-03,   1.58399757e-02,   2.19902184e-02],
       [  5.42677880e-03,   5.18921277e-03,   8.36420839e-03, ...,
         -1.03095000e-03,  -6.10198861e-03,  -7.59030180e-03],
       [  1.36481773e-02,   7.45378092e-03,   2.11911040e-02, ...,
          1.95971954e-03,   5.36268971e-03,   1.14685796e-02],
       ...,
       [  2.24978279e-03,  -8.75326741e-04,   2.32950407e-03, ...,
         -1.28143641e-04,  -2.11944656e-02,  -2.51237760e-02],
       [  1.80361510e-02,  -6.61070103e-03,   8.49732170e-03, ...,
         -2.00809147e-02,  -1.49447769e-01,  -2.40554710e-01],
       [  2.27027192e-02,  -6.62075409e-03,   1.39884270e-02, ...,
         -2.50248724e-02,  -2.34425555e-01,  -2.95888624e-01]]))
euhruska commented 6 years ago

had rerun this step, still leading to the same error, but no nan or infs in the C00 or C0t

C00.min()
-0.33721169507381465
C00.max()
0.53087998375466916
C0t.min()
-0.33818181071394315
C0t.max()
0.45154794412774701
euhruska commented 6 years ago

with Feliks figured that the reweighted C00 matrix, which is ok, goes to pyemma._ext.variational.solvers.direct.spd_inv_split and pyemma._ext.variational.solvers.direct.spd_eig goes to sm, Vm = spd_eig(C00), where sm is negative array([-3.11519952]) and leads in the next line https://github.com/markovmodel/PyEMMA/blob/devel/pyemma/_ext/variational/solvers/direct.py#L220 L = _np.dot(Vm, _np.diag(1.0/_np.sqrt(sm))) to fatal nan values That means the reweighted C00 matrix has negative eigenvalues, which prevents us from finishing the next tica step

error-koopman.zip

euhruska commented 6 years ago

solved, fixed bug