Skip to content

Commit

Permalink
Improved test
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoTrizio committed Apr 4, 2024
1 parent 52d8061 commit d7d8c8b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mlcolvar/core/transform/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,17 @@ def test_normalization():
norm = Normalization(in_features, mean=stats["mean"], range=stats["std"])

y = norm(X)
# print(X.mean(0),y.mean(0))
# print(X.std(0),y.std(0))

# test inverse
z = norm.inverse(y)
# print(X.mean(0),z.mean(0))
# print(X.std(0),z.std(0))
assert(torch.allclose(X.mean(0), z.mean(0)))
assert(torch.allclose(X.std(0) , z.std(0)))

# test inverse class
inverse = Inverse(norm)
q = inverse(y)
# print(X.mean(0),q.mean(0))
# print(X.std(0),q.std(0))
assert(torch.allclose(X.mean(0), q.mean(0)))
assert(torch.allclose(X.std(0), q.std(0)))
norm = Normalization(
in_features, mean=stats["mean"], range=stats["std"], mode="min_max"
)
Expand Down

0 comments on commit d7d8c8b

Please sign in to comment.