Skip to content

Commit

Permalink
Adjust thresholds (#30)
Browse files Browse the repository at this point in the history
* Lower threshold for checking after row-swap

* Relax check for stat. dist. invariance
  • Loading branch information
Marius1311 committed Oct 21, 2021
1 parent 05fa05c commit 8512e16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pygpcca/_gpcca.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _gram_schmidt_mod(X: np.ndarray, eta: np.ndarray) -> np.ndarray:
X[:, 0] = np.sqrt(eta)
# Raise, if the subspace changed!
dummy = subspace_angles(X, Xc)
if not np.allclose(dummy, 0.0, atol=1e-8, rtol=1e-5):
if not np.allclose(dummy, 0.0, atol=1e-7, rtol=1e-5):
logging.error(Xc)
logging.error(X)
raise ValueError(
Expand All @@ -153,7 +153,7 @@ def _gram_schmidt_mod(X: np.ndarray, eta: np.ndarray) -> np.ndarray:

# Raise, if the subspace changed!
dummy = subspace_angles(Q, Xc)
if not np.allclose(dummy, 0.0, atol=1e-8, rtol=1e-5):
if not np.allclose(dummy, 0.0, atol=1e-7, rtol=1e-5):
raise ValueError(
"The subspace of Q derived by eta-orthogonalization doesn't match the "
f"subspace of the original Q! The subspace angles are: {dummy}. "
Expand Down
2 changes: 1 addition & 1 deletion pygpcca/utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def _is_stationary_distribution(T: Union[np.ndarray, spmatrix], pi: np.ndarray)
raise ValueError("Shape mismatch.")

# check for invariance
if not np.allclose(T.T.dot(pi), pi, rtol=1e4 * EPS, atol=1e4 * EPS):
if not np.allclose(T.T.dot(pi), pi, rtol=1e6 * EPS, atol=1e6 * EPS):
dev = np.max(np.abs(T.T.dot(pi) - pi))
raise ValueError(
f"Stationary distribution is not invariant under the transition matrix. Maximal deviation = " f"{dev}"
Expand Down

0 comments on commit 8512e16

Please sign in to comment.