Skip to content

Commit

Permalink
check core set msm estimator compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
thempel committed Jul 1, 2019
1 parent 6018096 commit 8763ba8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pyemma/msm/estimators/_msm_estimator_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ def _get_dtraj_stats(self, dtrajs):
'Defining core set automatically; check correctness by calling self.core_set.')
else:
if set(_np.sort(_np.unique(_np.concatenate(dtrajs)))[1:]) != set(self.core_set):
raise RuntimeError('Core set definition does not match states in dtraj while'
'dtraj already contains unassigned states.')
self.logger.warning('dtraj containts states that are not in core set definition. '
'These states will be treated as unassigned.')

if self.core_set is not None:
self._dtrajs_original = dtrajs
Expand Down
6 changes: 1 addition & 5 deletions pyemma/msm/estimators/augmented_msm.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ def _estimate(self, dtrajs):
if _np.size(self.active_set) == 0:
raise RuntimeError('Active set is empty. Cannot estimate AMM.')

from pyemma.util.discrete_trajectories import index_states
self._active_state_indexes = index_states(dtrajs, subset=self.active_set)

# active count matrix and number of states
self._C_active = dtrajstats.count_matrix(subset=self.active_set)
self._nstates = self._C_active.shape[0]
Expand All @@ -342,7 +339,7 @@ def _estimate(self, dtrajs):
self._full2active[self.active_set] = _np.arange(len(self.active_set))

# slice out active states from E matrix
_dset = list(set(_np.concatenate(dtrajs)))
_dset = list(set(_np.concatenate(self._dtrajs_full)))
_rras = [_dset.index(s) for s in self.active_set]
self.E_active = self.E[_rras]

Expand Down Expand Up @@ -474,7 +471,6 @@ def _estimate(self, dtrajs):

_P = msmest.tmatrix(self._C_active, reversible=True, mu=self._pihat)

self._dtrajs_full = dtrajs
self._connected_sets = msmest.connected_sets(self._C_full)
self.set_model_params(P=_P, pi=self._pihat, reversible=True,
dt_model=self.timestep_traj.get_scaled(self.lag))
Expand Down
4 changes: 4 additions & 0 deletions pyemma/msm/estimators/bayesian_msm.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ def estimate(self, dtrajs, **kw):
return super(BayesianMSM, self).estimate(dtrajs, **kw)

def _estimate(self, dtrajs):

if self.core_set is not None and self.count_mode == 'effective':
raise RuntimeError('Cannot estimate core set MSM with effective counting.')

# conduct MLE estimation (superclass) first
_MLMSM._estimate(self, dtrajs)

Expand Down
2 changes: 2 additions & 0 deletions pyemma/msm/estimators/oom_reweighted_msm.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def __init__(self, lag=1, reversible=True, count_mode='sliding', sparse=False, c

def _estimate(self, dtrajs):
""" Estimate MSM """
if self.core_set is not None:
raise NotImplementedError('Core set MSMs currently not compatible with {}.'.format(self.__class__.__name__))
# remove last lag steps from dtrajs:
dtrajs_lag = [traj[:-self.lag] for traj in dtrajs]

Expand Down

0 comments on commit 8763ba8

Please sign in to comment.