Skip to content

Commit

Permalink
fix diff
Browse files Browse the repository at this point in the history
Signed-off-by: xadupre <[email protected]>
  • Loading branch information
xadupre committed Dec 23, 2024
1 parent e3ac8b7 commit bbb9940
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions tests/xgboost/test_xgboost_converters_base_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ def test_xgbregressor_sparse_base_score(self):
rf = XGBRegressor(n_estimators=3, max_depth=4, random_state=0, base_score=0.5)
rf.fit(X_sp, y)
expected = rf.predict(X).astype(np.float32).reshape((-1, 1))
expected_sparse = rf.predict(X_sp).astype(np.float32).reshape((-1, 1))
diff = np.abs(expected - expected_sparse)
self.assertNotEqual(diff.min(), diff.max(), atol=1e-5)
# expected sparse is expected ot be diffrent than expected,
# expected_sparse = rf.predict(X_sp).astype(np.float32).reshape((-1, 1))

onx = convert_xgboost(
rf,
Expand All @@ -64,9 +63,8 @@ def test_xgbregressor_sparse_no_base_score(self):
rf = XGBRegressor(n_estimators=3, max_depth=4, random_state=0)
rf.fit(X_sp, y)
expected = rf.predict(X).astype(np.float32).reshape((-1, 1))
expected_sparse = rf.predict(X_sp).astype(np.float32).reshape((-1, 1))
diff = np.abs(expected - expected_sparse)
self.assertNotEqual(diff.min(), diff.max(), atol=1e-5)
# expected sparse is expected ot be diffrent than expected,
# expected_sparse = rf.predict(X_sp).astype(np.float32).reshape((-1, 1))

onx = convert_xgboost(
rf,
Expand Down Expand Up @@ -94,9 +92,8 @@ def test_xgbclassifier_sparse_base_score(self):
rf = XGBClassifier(n_estimators=3, max_depth=4, random_state=0, base_score=0.5)
rf.fit(X_sp, y)
expected = rf.predict_proba(X).astype(np.float32).reshape((-1, 1))
expected_sparse = rf.predict_proba(X_sp).astype(np.float32).reshape((-1, 1))
diff = np.abs(expected - expected_sparse)
self.assertNotEqual(diff.min(), diff.max(), atol=1e-5)
# expected sparse is expected ot be diffrent than expected,
# expected_sparse = rf.predict_proba(X_sp).astype(np.float32).reshape((-1, 1))

onx = convert_xgboost(
rf,
Expand Down Expand Up @@ -124,9 +121,8 @@ def test_xgbclassifier_sparse_no_base_score(self):
rf = XGBClassifier(n_estimators=3, max_depth=4, random_state=0)
rf.fit(X_sp, y)
expected = rf.predict_proba(X).astype(np.float32).reshape((-1, 1))
expected_sparse = rf.predict_proba(X_sp).astype(np.float32).reshape((-1, 1))
diff = np.abs(expected - expected_sparse)
self.assertNotEqual(diff.min(), diff.max(), atol=1e-5)
# expected sparse is expected ot be diffrent than expected,
# expected_sparse = rf.predict_proba(X_sp).astype(np.float32).reshape((-1, 1))

onx = convert_xgboost(
rf,
Expand Down

0 comments on commit bbb9940

Please sign in to comment.