Skip to content

Commit

Permalink
GH-16312: fix test failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
wendycwong committed Jul 26, 2024
1 parent 761651d commit 492c3e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions h2o-algos/src/test/java/hex/glm/GLMConstrainedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,16 @@ public void generateConstraint4FrameNAnswer() {
_coeffNames1.get(19), _coeffNames1.get(20), _coeffNames1.get(21), _coeffNames1.get(22), "constant",
_coeffNames1.get(4), _coeffNames1.get(5), _coeffNames1.get(6), "constant", _coeffNames1.get(6),
_coeffNames1.get(33), _coeffNames1.get(7), _coeffNames1.get(24), _coeffNames1.get(25), "constant",
_coeffNames1.get(1), _coeffNames1.get(coefLen-3), "constant"})
_coeffNames1.get(1), _coeffNames1.get(coefLen-3), "constant", _coeffNames1.get(0), _coeffNames1.get(1), "constant"})
.withDataForCol(1, new double [] {-0.3, 0.5, 1.0, -3.0, 3, -4, 0.5, 0.1, -0.2, 2.0, -0.1, -0.4,
0.8, 0.1, -0.5, 0.7, -1.1, 2.0, 0.5, -0.3, 0.5, -1.5, -0.3, -1.0, 1.0, -9.0})
0.8, 0.1, -0.5, 0.7, -1.1, 2.0, 0.5, -0.3, 0.5, -1.5, -0.3, -1.0, 1.0, -9.0,-1, -1, 0})
.withDataForCol(2, new String[] {"lessthanequal", "lessthanequal", "lessthanequal", "lessthanequal",
"lessthanequal", "lessthanequal", "lessthanequal", "equal", "equal", "lessthanequal",
"lessthanequal", "lessthanequal", "lessthanequal", "equal", "equal", "equal", "equal", "equal",
"equal", "equal", "equal", "equal", "equal", "lessthanequal", "lessthanequal", "lessthanequal"})
"equal", "equal", "equal", "equal", "equal", "lessthanequal", "lessthanequal", "lessthanequal",
"lessthanequal", "lessthanequal", "lessthanequal"})
.withDataForCol(3, new int[]{0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 6, 6,
6, 7, 7 ,7}).build();
6, 7, 7 ,7, 8, 8, 8}).build();
Scope.track(_linearConstraint4);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def test_bad_lambda_specification():
print(coefs)
print(glm.getConstraintsInfo(model))
# beta constraints should be satisfied
assert coefs["x1"] >= 0.03, "beta constraint x1 ({0}) >= 0.03 is violated!".format(coefs["x1"])
assert coefs["x1"] >= 0.03 or abs(coefs["x1"]-0.03) < 1e-6, "beta constraint x1 ({0}) >= 0.03 is violated!".format(coefs["x1"])

# beta constraints
bc = []
Expand All @@ -155,7 +155,7 @@ def test_bad_lambda_specification():
print(coefs)
print(glm.getConstraintsInfo(model))
# beta constraints should always be satisfied
assert coefs["x1"] <= 1.5, "beta constraint x1 ({0}) >= 1.5 is violated.".format(coefs["x1"])
assert coefs["x1"] <= 1.5 or abs(1.5-coefs["x1"])<1e-6, "beta constraint x1 ({0}) >= 1.5 is violated.".format(coefs["x1"])

if __name__ == "__main__":
pyunit_utils.standalone_test(test_bad_lambda_specification)
Expand Down

0 comments on commit 492c3e4

Please sign in to comment.