def test_iterator(self): chunksize = 1000 for itraj, chunk in self.tica_obj.iterator(chunk=chunksize): assert types.is_int(itraj) assert types.is_float_matrix(chunk) self.assertLessEqual(chunk.shape[0], (chunksize + self.lag)) assert chunk.shape[1] == self.tica_obj.dimension()
def test_get_output(self): O = self.inp.get_output() assert types.is_list(O) assert len(O) == 1 assert types.is_float_matrix(O[0]) assert O[0].shape[0] == 100 assert O[0].shape[1] == self.inp.dimension()
def test_get_output(self): O = self.pca_obj.get_output() assert types.is_list(O) assert len(O) == 1 assert types.is_float_matrix(O[0]) assert O[0].shape[0] == self.T assert O[0].shape[1] == self.pca_obj.dimension()
def test_iterator(self): self.inp.chunksize = 100 assert self.inp.chunksize == 100 for itraj, chunk in self.inp: assert types.is_int(itraj) assert types.is_float_matrix(chunk) assert chunk.shape[0] == self.inp.chunksize assert chunk.shape[1] == self.inp.dimension()
def test(self): # make it deterministic with numpy_random_seed(0): data = np.random.randn(100, 10) tica_obj = api.tica(data=data, lag=10, dim=1) Y = tica_obj._transform_array(data) # right shape assert types.is_float_matrix(Y) assert Y.shape[0] == 100 assert Y.shape[1] == 1, Y.shape[1]
def test(self): np.random.seed(0) data = np.random.randn(100, 10) tica_obj = api.tica(data=data, lag=10, dim=1) tica_obj.parametrize() Y = tica_obj._map_array(data) # right shape assert types.is_float_matrix(Y) assert Y.shape[0] == 100 assert Y.shape[1] == 1
def test(self): np.random.seed(0) data = np.random.randn(100, 10) tica_obj = api.tica(data=data, lag=10, dim=1) tica_obj.parametrize() Y = tica_obj._map_array(data) # right shape assert types.is_float_matrix(Y) assert Y.shape[0] == 100 assert Y.shape[1] == 1
def test(self): # FIXME: this ugly workaround is necessary... np.random.seed(0) data = np.random.randn(100, 10) tica_obj = api.tica(data=data, lag=10, dim=1) tica_obj.parametrize() Y = tica_obj._transform_array(data) # right shape assert types.is_float_matrix(Y) assert Y.shape[0] == 100 assert Y.shape[1] == 1
def set_model_params(self, P=None, pobs=None, pi=None, reversible=None, dt_model='1 step', neig=None): """ Parameters ---------- P : ndarray(m,m) coarse-grained or hidden transition matrix pobs : ndarray (m,n) observation probability matrix from hidden to observable discrete states pi : ndarray(m), optional, default=None stationary or distribution. Can be optionally given in case if it was already computed, e.g. by the estimator. reversible : bool, optional, default=None whether P is reversible with respect to its stationary distribution. If None (default), will be determined from P dt_model : str, optional, default='1 step' time step of the model neig : int or None The number of eigenvalues / eigenvectors to be kept. If set to None, all eigenvalues will be used. """ _MSM.set_model_params(self, P=P, pi=pi, reversible=reversible, dt_model=dt_model, neig=neig) # set P and derived quantities if available if pobs is not None: # check and save copy of output probability assert _types.is_float_matrix( pobs), 'pobs is not a matrix of floating numbers' assert _np.allclose(pobs.sum(axis=1), 1), 'pobs is not a stochastic matrix' self._nstates_obs = pobs.shape[1] self.update_model_params(pobs=pobs)
def test_iterator(self): for itraj, chunk in self.pca_obj: assert types.is_int(itraj) assert types.is_float_matrix(chunk) assert chunk.shape[1] == self.pca_obj.dimension()
def test_iterator(self): for itraj, chunk in self.pca_obj: assert types.is_int(itraj) assert types.is_float_matrix(chunk) assert chunk.shape[0] <= self.pca_obj.chunksize + self.lag assert chunk.shape[1] == self.pca_obj.dimension()