本文整理汇总了Python中pyemma.util.numeric.assert_allclose函数的典型用法代码示例。如果您正苦于以下问题:Python assert_allclose函数的具体用法?Python assert_allclose怎么用?Python assert_allclose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_allclose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pcca_1
def test_pcca_1(self):
P = np.array([[1, 0],
[0, 1]])
chi = pcca(P, 2)
sol = np.array([[1., 0.],
[0., 1.]])
assert_allclose(chi, sol)
示例2: test_count_matrix
def test_count_matrix(self):
"""Small test cases"""
C = count_matrix([self.S1, self.S2], 1, sliding=True).toarray()
assert_allclose(C, self.B1_sliding)
C = count_matrix([self.S1, self.S2], 2, sliding=True).toarray()
assert_allclose(C, self.B2_sliding)
示例3: test_fingerprint_relaxation
def test_fingerprint_relaxation(self):
one_vec = np.ones(self.T.shape[0])
relax_amp = np.dot(self.p0, self.R) * np.dot(self.L, self.obs1)
tsn, relax_ampn = fingerprint_relaxation(self.T, self.p0, self.obs1, k=self.k)
assert_allclose(tsn, self.ts)
assert_allclose(relax_ampn, relax_amp)
示例4: test_hitting1
def test_hitting1(self):
P = np.array([[0., 1., 0.],
[0., 1., 0.],
[0., 0., 1.]])
sol = np.array([1, 0, 0])
assert_allclose(hitting_probability(P, 1), sol)
assert_allclose(hitting_probability(P, [1, 2]), sol)
示例5: test_hitting2
def test_hitting2(self):
P = np.array([[1.0, 0.0, 0.0, 0.0],
[0.1, 0.8, 0.1, 0.0],
[0.0, 0.0, 0.8, 0.2],
[0.0, 0.0, 0.2, 0.8]])
sol = np.array([0., 0.5, 1., 1.])
assert_allclose(hitting_probability(P, [2, 3]), sol)
示例6: test_pathways_sparse
def test_pathways_sparse(self):
paths, capacities = pathways(self.F_sparse, self.A, self.B)
self.assertTrue(len(paths) == len(self.paths))
self.assertTrue(len(capacities) == len(self.capacities))
for i in range(len(paths)):
assert_allclose(paths[i], self.paths[i])
assert_allclose(capacities[i], self.capacities[i])
示例7: test_grossflux
def test_grossflux(self):
flux = self.bdc.flux(self.a, self.b)
fluxn = self.tpt.gross_flux
assert_allclose(fluxn, flux)
fluxn = self.tpt_fast.gross_flux
assert_allclose(fluxn, flux)
示例8: test_totalflux
def test_totalflux(self):
F = self.bdc.totalflux(self.a, self.b)
Fn = self.tpt.total_flux
assert_allclose(Fn, F)
Fn = self.tpt_fast.total_flux
assert_allclose(Fn, F)
示例9: test_stationary_distribution
def test_stationary_distribution(self):
mu = self.mu
mun = self.tpt.stationary_distribution
assert_allclose(mun, mu)
mun = self.tpt_fast.stationary_distribution
assert_allclose(mun, mu)
示例10: test_forward_committor
def test_forward_committor(self):
qplus = self.qplus
qplusn = self.tpt.forward_committor
assert_allclose(qplusn, qplus)
qplusn = self.tpt_fast.forward_committor
assert_allclose(qplusn, qplus)
示例11: test_rate
def test_rate(self):
k = self.bdc.rate(self.a, self.b)
kn = self.tpt.rate
assert_allclose(kn, k)
kn = self.tpt_fast.rate
assert_allclose(kn, k)
示例12: test_backward_committor
def test_backward_committor(self):
qminus = self.qminus
qminusn = self.tpt.backward_committor
assert_allclose(qminusn, qminus)
qminusn = self.tpt_fast.backward_committor
assert_allclose(qminusn, qminus)
示例13: test_connected_count_matrix
def test_connected_count_matrix(self):
"""Directed"""
C_cc = largest_connected_submatrix(self.C)
assert_allclose(C_cc, self.C_cc_directed)
"""Undirected"""
C_cc = largest_connected_submatrix(self.C, directed=False)
assert_allclose(C_cc, self.C_cc_undirected)
示例14: test_prior_const
def test_prior_const(self):
with warnings.catch_warnings(record=True) as w:
Bn = prior_const(self.C)
assert_allclose(Bn, self.alpha_def * self.B_const)
with warnings.catch_warnings(record=True) as w:
Bn = prior_const(self.C, alpha=self.alpha)
assert_allclose(Bn, self.alpha * self.B_const)
示例15: test_prior_rev
def test_prior_rev(self):
with warnings.catch_warnings(record=True) as w:
Bn = prior_rev(self.C)
assert_allclose(Bn, -1.0 * self.B_rev)
with warnings.catch_warnings(record=True) as w:
Bn = prior_rev(self.C, alpha=self.alpha)
assert_allclose(Bn, self.alpha * self.B_rev)